Skip to content

Instantly share code, notes, and snippets.

Junxiao Shi yoursunny

Block or report user

Report or block yoursunny

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yoursunny
yoursunny / bpi-r2-sdimage.sh
Created Aug 27, 2019
OpenWrt 18.06.4 SD eMMC image for Banana Pi R2
View bpi-r2-sdimage.sh
#!/bin/bash
# OpenWrt 18.06.4 for Banana Pi R2
# Make SD or eMMC image from official kernel and rootfs images.
# Inspired by https://github.com/BPI-SINOVOIP/openwrt/commit/b4dfaeca4d33ad88364bfb7df353b3dfca2883fe
set -e
KIND=$1
if [[ $KIND != sd ]] && [[ $KIND != emmc ]]; then
echo Usage: $0 '<sd|emmc> [outfile]' >/dev/stderr
@yoursunny
yoursunny / EmojiTetra.ino
Last active Jun 12, 2018
Watch @EmojiTetra Live on ESP32 OLED Display https://yoursunny.com/t/2018/EmojiTetra-OLED/
View EmojiTetra.ino
// Watch @EmojiTetra Live on ESP32 OLED Display
// https://yoursunny.com/t/2018/EmojiTetra-OLED/
#include <HTTPClient.h>
#include <U8g2lib.h> // https://github.com/olikraus/U8g2_Arduino/tree/e4178df6b8c69f1880d6d44719a286540e9e94a5
#include <WiFi.h>
const char* WIFI_SSID = "my-wifi";
const char* WIFI_PASS = "my-password";
View KeyInWifi.cpp
#include "KeyInWifi.hpp"
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <WiFi.h>
#include <WString.h>
#include <U8x8lib.h>
#define DELAY_CHOICE 250
View PacketDump.ino
// https://yoursunny.com/t/2018/PacketDump/
#include <cassert>
#include <ESP8266WiFi.h>
#include <lwip/netif.h>
// #include <user_interface.h>
#include "PacketParser.hpp"
const char* WIFI_SSID = "my-ssid";
const char* WIFI_PASS = "my-pass";
@yoursunny
yoursunny / cherry-pick.sh
Created Feb 14, 2017
git cherry-pick a feature branch on top of current HEAD
View cherry-pick.sh
#!/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
View readvertise.hpp
// 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 Sep 1, 2016
move image to clicked position (Processing 3)
View ImageMoveToClick.pde
PImage img;
int curX, curY;
int dstX, dstY;
void setup()
{
size(600, 600);
curX = dstX = width / 2;
curY = dstY = height / 2;
View nfdc-design.md

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:

View wsface.htm
<!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) {
View pwrstat.c
// 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>
You can’t perform that action at this time.