Skip to content

Instantly share code, notes, and snippets.

View yoursunny's full-sized avatar
📟

Junxiao Shi yoursunny

📟
View GitHub Profile
@yoursunny
yoursunny / ccnd_stats.patch
Created October 3, 2012 23:10
ccnd robots.txt patch
81a82,88
> static const char *respRobots =
> "HTTP/1.1 200 OK" CRLF
> "Content-Type: text/plain" CRLF
> "Content-Length: 26" CRLF CRLF
> "User-Agent: *" CRLF
> "Disallow: /";
>
99c106
< char rbuf[16];
@yoursunny
yoursunny / ndnws.js
Created October 4, 2012 18:21
CCNx WebSocket proxy
var WebSocketServer = require('ws').Server;
var net = require('net');
var wss = new WebSocketServer({port:9696,host:'0.0.0.0'});
wss.on('connection', function(ws) {
console.log('wsconn');
var sock_ready = false;
var send_queue = [];
var sock = net.createConnection(9695);
ws.on('message',function(message){
@yoursunny
yoursunny / repo2email.sh
Last active December 10, 2015 02:58
when a repo has a new commit, send email with code package
#!/bin/bash
# USAGE
# 1. clone / check out a repo to reponame/
# 2. execute once: echo 0 > reponame/repo2email.ver
# 3. if needed, create reponame/repo2email.prepare.sh script which will be called before packaging
# 4. set up crontab to execute: ./repo2email.sh 'reponame' 'svn' '[email protected];[email protected]'
reponame=$1
repotype=$2
@yoursunny
yoursunny / ndn-install.sh
Last active December 10, 2015 23:19
NDN platform easy installer
#!/bin/bash
# NDN platform easy installer for Ubuntu 12.04
# programs included:
# NDNx (with ndnd /robots.txt patch)
# CCNx shim for NDNx
# NDNLP
# ndnping
# PyNDN
# updated: 2013-09-02
@yoursunny
yoursunny / oberon0.lang
Last active December 12, 2015 02:28
Oberon0 syntax highlighter for gtksourceview-3.0 Place this file in ~/.local/share/gtksourceview-3.0/language-specs/ Limitation: does not support nested comments.
<?xml version="1.0" encoding="UTF-8"?>
<language id="oberon0" _name="Oberon0" version="2.0" _section="Sources">
<metadata>
<property name="globs">*.ob0;*.ob</property>
</metadata>
<styles>
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="error" _name="Error" map-to="def:error"/>
<style id="string" _name="String" map-to="def:string"/>
@yoursunny
yoursunny / ndnx-ccnx-shim.sh
Last active December 20, 2015 19:58
CCNx shim for NDNx
#!/bin/bash
# CCNx shim for NDNx
# This script creates shim headers so that apps written for CCNx can compile with NDNx.
# NDNx is available at https://github.com/named-data/ndnx
#
# Usage: sudo ./ndnx-ccnx-shim.sh
# updated: 2013-09-02
INCLUDE_DIR=/usr/local/include
@yoursunny
yoursunny / ndnd_stats_robotstxt.patch
Created August 8, 2013 17:25
ndnd robots.txt patch
@@ -81,6 +81,13 @@
"HTTP/1.1 405 Method Not Allowed" CRLF
"Connection: close" CRLF CRLF;
+static const char *respRobots =
+ "HTTP/1.1 200 OK" CRLF
+ "Content-Type: text/plain" CRLF
+ "Content-Length: 26" CRLF CRLF
+ "User-Agent: *" CRLF
+ "Disallow: /";
@yoursunny
yoursunny / README
Last active January 2, 2016 05:59
spreadsheet2sjtubbs
spreadsheet2sjtubbs script
This script updates the contents of a worksheet in Google Spreadsheet into a post at SJTUBBS.
Setup instructions:
1. Download a copy of config.inc.php and spreadsheet2sjtubbs.cli.php
2. Open the Spreadsheet, click [File - Publish to the Web] menu item,
click [Start Publishing]
3. In [Get a link to the published data],
@yoursunny
yoursunny / ndn-update-license.sh
Last active March 18, 2019 12:14
NDN project license boilerplate update
#!/bin/bash
# https://gist.github.com/yoursunny/6297f3c70f5441213184
LICENSE_NFD='''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
* Washington University in St. Louis,
@yoursunny
yoursunny / kiss50000.py
Created April 4, 2015 17:46
How long would you need to kiss 1/20 of the student body at the University of Arizona?
#!/usr/bin/python2
# https://www.facebook.com/permalink.php?story_fbid=921147667906858&id=531306850224277
# My confession is that technically I have probably kissed 1/20th of the Student body here are U of A. It's truly embarrassing to say but I'm glad to get that off my chest. -EOS
# Number of students at U of A = 50,000; You claim to kiss: 1/20 x 50,000 = 2,500; Math, Bitch!!
# This script computes number of kisses necessary to kiss 2500 unique students, or the entire student body.
import random