Skip to content

Instantly share code, notes, and snippets.

@bafu
bafu / LpTable.js
Last active August 29, 2015 14:04
// ==UserScript==
// @name LpTable
// @namespace http://rickey-nctu.blogspot.tw/
// @description Transform Launchpad bug list to be a table with ability of sortable, filterable and unlimit bugs number
// @include *bugs.launchpad.net/*
// @version 6
// @grant GM_getValue
// @grant GM_setValue
// @require http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.2.js
// @require http://datatables.net/release-datatables/media/js/jquery.dataTables.js
@bafu
bafu / pomodoro-cli
Created November 2, 2015 12:15
Command line Pomodoro
#!/bin/sh
# http://superuser.com/questions/224265/pomodoro-timer-for-linux
VERSION="1.0"
LOGFILE="$HOME/.cache/pomodoro.log"
DURATION_TASK="1500" # 25-min
DURATION_SHORT_BREAK="300" # 5-min
DURATION_LONG_BREAK="900" # 15-min
#DURATION_TASK="5" # 25-min
#DURATION_SHORT_BREAK="3" # 5-min
@bafu
bafu / 0_reuse_code.js
Created November 27, 2015 07:14
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
@bafu
bafu / postserver.py
Created February 15, 2016 14:28
Simple POST server
#!/usr/bin/python3
# Source: http://stackoverflow.com/questions/13146064/simple-python-webserver-to-save-file
#
# Usage:
# # Server
# $ python3 -m webserver
#
# # Client: POST
# import requests
# requests.post('http://localhost:5566/post', json={'key':'value'})
@bafu
bafu / vgg16-hidden-layer-size
Created March 16, 2016 10:12
Display the size of hidden layers in vgg16.
#!/usr/bin/python
# Display the size of hidden layers in vgg16.
import functools
import operator
import h5py
f = h5py.File('vgg16_weights.h5', 'r')
weight_counter = 0
@bafu
bafu / apk-installer
Created July 7, 2016 16:39
Install and launch APK for testing.
#!/bin/bash
#
# Install and launch built Android APK into the physical target
# connected by an USB cable. If there is an existing APK installed,
# it will be removed first.
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@bafu
bafu / recordDynacolorCam.sh
Last active November 12, 2020 03:26
Record MJPEG/H.264 stream as segments by ffmpeg
#!/bin/bash
# Dynacolor Dynahawk W2V1-H IP Camera
Ip="192.168.0.2"
HttpStreamSource="http://$Ip:8008" # mjpeg, ~3 MB / 1 sec
RtspStreamSource="rtsp://$Ip/h264" # h.264, ~0.3 MB / 1 sec
# Save streaming until pressed 'q'.
# Save a segment every 60 secs.
#ffmpeg -i $HttpStreamSource -c copy -map 0 -f segment -segment_time 60 -segment_format mp4 "capture-%03d.mp4"
@bafu
bafu / mba6.2_camhelper.sh
Last active November 22, 2019 03:56
Enable MacBook Air 6.2 camera on Ubuntu
#!/bin/bash
# https://help.ubuntu.com/community/MacBookAir6-2/Trusty
# https://github.com/patjak/bcwc_pcie/wiki/Get-Started
ENABLER='/tmp/bcwc_pcie'
ACTION="$1"
show_help() {
echo "Please provide action parameter: install, load, unload, test, help"
@bafu
bafu / googlenet.prototxt
Created September 8, 2016 04:35
GIE GoogLeNet
input: "data"
input_dim: 4
input_dim: 3
input_dim: 224
input_dim: 224
layer {
name: "conv1/7x7_s2"
type: "Convolution"
bottom: "data"
top: "conv1/7x7_s2"
@bafu
bafu / darkflow-app-example.patch
Created April 22, 2017 10:21
Darkflow Python Application Example
diff --git a/darkflow/net/flow.py b/darkflow/net/flow.py
index a5b8ceb..bb60704 100644
--- a/darkflow/net/flow.py
+++ b/darkflow/net/flow.py
@@ -90,7 +90,8 @@ def return_predict(self, im):
"y": tmpBox[2]},
"bottomright": {
"x": tmpBox[1],
- "y": tmpBox[3]}
+ "y": tmpBox[3]},