Skip to content

Instantly share code, notes, and snippets.

View clarkli86's full-sized avatar

Clark Li clarkli86

  • Adelaide, Australia
View GitHub Profile
#!python3
import requests
import json
import pprint
import csv
def create_work_packages(subjects):
resp = requests.get('http://openproject.cohda.wireless/api/v3/work_packages/available_projects',
headers = {'Content-type':'application/json'},
auth= ('apikey', 'cdd4fb6c5f9df675e866f5b743e249d8bd286e6dd2a2ef4fa21f51e1a04643cb'))
@clarkli86
clarkli86 / systemd-analyze.sh
Created October 31, 2017 23:25
systemd-analyze
systemd-analyze plot > something.svg
@clarkli86
clarkli86 / ubx_commands
Last active April 27, 2017 06:07
ublox ubx commands
# Hardware (watchdog) reset - same as power cycle
echo -ne '\xb5\x62\x06\x04\x04\x00\x00\x00\x00\x00\x0e\x64' > $DEVICES
# Clear msg and inf settings saved in u-blox
echo -ne '\xb5\x62\x06\x09\x0c\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x21\xd7' > $DEVICES
@clarkli86
clarkli86 / tcpdump.sh
Last active April 28, 2017 02:20
tcpdump
# Dump tx
sudo tcpdump -npi cw-mon-tx -s0 -w /mnt/ubi/test_tx.pcap &
# Dump received TCI messages
sudo tcpdump -n udp dst portrange 13001 -vv -w
tcpdump -npi eth0 -vv -w /mnt/src/tci-$(date +%s).pcap udp dst portrange 13001 &
tcpdump -npi cw-mon-tx -vv -w /mnt/src/tx-$(date +%s).pcap &
@clarkli86
clarkli86 / show_all_eligible_svn_commits.sh
Created February 9, 2017 02:36
Show all eligible SVN commits for merge
svn mergeinfo --show-revs eligible $SOURCE $DISTINATION | xargs -i svn log $SOURCE -r '{}'
@clarkli86
clarkli86 / too_many_files_open.sh
Created February 9, 2017 02:34
Too many files open in Linux
$sudo sh -c "echo 2560 > /proc/sys/fs/inotify/max_user_instances"
@clarkli86
clarkli86 / Makefile
Created July 27, 2016 04:53
Build ko outside kernel source tree
# Run me as
# ARCH=arm CROSS_COMPILE=~/buildroot-2016.05/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi- make
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := kobject.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
@clarkli86
clarkli86 / sha1sum_recursively.sh
Created July 27, 2016 02:05
sha1sum recursively in bash
find ./path/to/directory/ -type f -print0 | xargs -0 sha1sum
# from http://superuser.com/questions/458326/sha1sum-for-a-directory-of-directories
@clarkli86
clarkli86 / Fix boost source fetched by wget
Last active June 18, 2016 06:49
VIM macro to replace the html escaping
qa
:%s/&lt;/</eg // e is to skip 'text not found'
:%s/&gt;/>/eg
:%s/&quot;/"/eg
:%s/&amp;/&/eg
:%s/<<\(.*\)>\(.*\)<.*>>/<\2>/eg
q
// To replay on one file
@@a
@clarkli86
clarkli86 / StareButton.cs
Last active June 9, 2016 02:48 — forked from flarb/StareButton.cs
This is a 'stare button' for Google Cardboard apps where you just want to stare at a button over time to select it.
using System;
using System.Reflection;
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
public class StareButton : MonoBehaviour, IEventSystemHandler, IPointerExitHandler, IPointerEnterHandler, ISelectHandler {