Skip to content

Instantly share code, notes, and snippets.

View yoursunny's full-sized avatar
📟

Junxiao Shi yoursunny

📟
View GitHub Profile
@yoursunny
yoursunny / cherry-pick.sh
Created February 14, 2017 16:22
git cherry-pick a feature branch on top of current HEAD
#!/bin/bash
# This script cherry-picks the top commit of a feature branch onto the current HEAD.
# It is designed to work with NDN Gerrit https://gerrit.named-data.net/
# This script should be placed outside of the repository directory.
# Suppose your repository looks like:
# A---B---C <== master
# \
# \-D <== feature1
# After checking out master, executing `../cherry-pick.sh feature1` gives you:
# A---B---C <== master
// NFD-RIB readvertise feature
// https://redmine.named-data.net/issues/3784
/** \brief reference to a RIB route
*/
struct RibRouteRef
{
shared_ptr<RibEntry> entry;
RibEntry::const_iterator route;
};
@yoursunny
yoursunny / ImageMoveToClick.pde
Created September 1, 2016 02:05
move image to clicked position (Processing 3)
PImage img;
int curX, curY;
int dstX, dstY;
void setup()
{
size(600, 600);
curX = dstX = width / 2;
curY = dstY = height / 2;

nfdc interactive design

This document proposes a new design for nfdc command which combines existing nfdc and nfd-status commands, as a unified command for monitoring and controlling NFD.

operation modes

nfdc has three operation modes.

one-shot mode executes a single command. An example interaction looks like:

<!doctype html>
<title>WebSocketTransport FaceScope test</title>
<p>
<input id="btn127" type="button" value="127.0.0.1">
<input id="btn1" type="button" value="::1">
</p>
<script src="https://cdn.rawgit.com/named-data/ndn-js/fae355398c0961e2d4e0c8c709e38b435e421fb1/build/ndn.js"></script>
<script>
var face;
function openFace(host) {
// gcc -o pwrstat pwrstat.c
// display C.H.I.P power and battery status
// AXP209-internal-temperature USB-voltage USB-current battery-voltage [+-]battery-current
// https://bbs.nextthing.co/t/pwrstat-c-talk-to-axp209-over-i2c-in-c/6710?u=yoursunny
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdlib.h>
@yoursunny
yoursunny / twttr-to-ifttt.flow.json
Last active July 10, 2016 01:35
Repost Twitter to Facebook with Losant and IFTTT https://yoursunny.com/t/2016/twitter-ifttt/
{
"globals": [
{
"key": "oauth_consumer_key",
"type": "string"
},
{
"key": "oauth_consumer_secret",
"type": "string"
},
// ESP8266 register voucher code on Clearwave Solution WiFi <http://www.getclearwave.com/> Tucson AZ
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <Streaming.h>
const char* WIFI_SSID = "community-ssid";
const char* WIFI_PASS = "community-password";
const char* VOUCHER = "xxxxxxxx";
@yoursunny
yoursunny / gprof-inclusivetimetree-html.php
Created April 5, 2016 00:05
prettyprint gprof inclusive time tree
<?php
$f = fopen('php://stdin', 'r');
echo <<<EOT
<style>
ul { margin-left:0; padding-left:1em; border-left:solid 2px #999; }
li { list-style:none; padding-bottom:1ex; }
b { cursor:pointer; }
b:before { content:'- '; }
li.leaf > b:before { content:''; }
@yoursunny
yoursunny / ndntestbed-certexpiry.sh
Created March 6, 2016 16:42
NDN testbed certificate expiry check
#!/bin/bash
TPMDIR=/tmp/ndntestbed-certexpiry_$(date +%s)
NOW=$(date -u +%s)
mkdir -p $TPMDIR
export HOME=$TPMDIR
pushd $TPMDIR >/dev/null
curl -s http://ndncert.named-data.net/cert/list/ > certs.txt