Skip to content

Instantly share code, notes, and snippets.

@congpeijun
congpeijun / dc1.json
Created September 29, 2019 04:13 — forked from FlashSoft/dc1.json
斐讯DC1(node-red flow)
[
{
"id": "966d4a60.9dcaa8",
"type": "tcp in",
"z": "f5965567.2c44c8",
"name": "",
"server": "server",
"host": "",
"port": "8000",
"datamode": "stream",
@congpeijun
congpeijun / mongodb-facet-combine.js
Created July 24, 2018 08:50 — forked from cthurston/mongodb-facet-combine.js
MongoDb combine $facet results into a single result set.
db.getCollection('list').aggregate([
{
$facet: {
"events":[{
$match: {
'type': 'Event'
}
}],
"tasks": [{
$match: {
@congpeijun
congpeijun / pi_qemu.sh
Created February 1, 2017 12:30 — forked from JasonGhent/pi_qemu.sh
OSX raspberry pi emulation via QEMU. v2 attempt @ https://gist.github.com/JasonGhent/922f38f57c8cb77b10f3
# pulled from http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
# expanded via http://superuser.com/questions/690060/how-to-enable-network-with-a-raspberry-pi-emulated-on-qemu
# tested with 2015-02-16-raspbian-wheezy.zip on OSX Mavericks
# OSX terminal
brew install qemu
# kernel-qemu is a linux kernel compiled with ARM1176 support.
# learn more here: http://xecdesign.com/compiling-a-kernel/
curl -OL http://xecdesign.com/downloads/linux-qemu/kernel-qemu
curl -o raspbian_latest.zip -L http://downloads.raspberrypi.org/raspbian_latest
@congpeijun
congpeijun / ddns.sh
Created July 29, 2016 13:49 — forked from TommyLau/ddns.sh
Tommy DnsPod DDNS Client
#!/bin/sh
########################################
#
# Tommy DnsPod DDNS Client v0.2.0
#
# Author: Tommy Lau <tommy@gen-new.com>
#
# Created: 2015-02-23 08:52:00 UTC
# Updated: 2016-07-15 15:48:00 UTC
@congpeijun
congpeijun / 0_reuse_code.js
Created March 26, 2014 02:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@congpeijun
congpeijun / ical-RFC-2445-4.1.php
Created December 6, 2012 05:52 — forked from hugowetterberg/ical-RFC-2445-4.1.php
A useful function for splitting ical content into 75-octet lines, taking multibyte characters into account. See: http://www.ietf.org/rfc/rfc2445.txt, section 4.1
<?php
mb_internal_encoding("UTF-8");
$desc = <<<TEXT
<p>Lines of text SHOULD NOT be longer than 75 octets, (och hör på den) excluding the line break. Long content lines SHOULD be split into a multiple line representations using a line "folding" technique.</p>
That is, a long line can be split between any two characters by inserting a CRLF
immediately followed by a single linear white space character (i.e.,
SPACE, <b>US-ASCII</b> decimal 32 or HTAB, US-ASCII decimal 9). Any sequence
of CRLF followed immediately by a single linear white space character
is ignored (i.e., removed) when processing the content type.