Skip to content

Instantly share code, notes, and snippets.

View htruong's full-sized avatar
🎯
Focusing

Huan Truong htruong

🎯
Focusing
View GitHub Profile
@htruong
htruong / fontstripper.pe
Created January 11, 2012 20:59
Font Forge Glyph Stripper
#!/usr/bin/fontforge
/* --------------- (c) 2012 Huan Truong ---------------- */
/* Sexy script to strip unused glyphs from ttf file. */
/* ----------------------------------------------------- */
Open($argv[1]);
SelectNone();
@htruong
htruong / pjlinkutil.pl
Created January 25, 2012 17:45
Projector Link PJLink Control script
#!/usr/bin/perl
# ------------------------------------------------------------
# Projector PJLink Control Script
#
# ------------------------------------------------------------
# 2012 IT Services, Truman State University
#
# Maintained by Huan Truong, get the latest version at
# https://gist.github.com/1677547
<?xml version="1.0" encoding="utf-8"?>
<config>
<allowed-sites>
<start-url>https://www.google.com</start-url>
<host-regex>^.*google\.com$</host-regex>
<host-regex>^.*slashdot.org$</host-regex>
<host-regex>^.*facebook.com$</host-regex>
</allowed-sites>
</config>
@htruong
htruong / adblock-gen.sh
Last active August 29, 2015 13:57
Adblock-gen
#!/bin/sh
## install adblock v4.5mod
## With jimmies' modifications
## encoded: cat adblock.sh | gzip -c | openssl enc -e -base64
PREFIX="/tmp/mnt/sda1/adblock/" ## adjust this!
[ -d "$PREFIX" ] || mkdir -p "$PREFIX"
echo "
H4sIAB+rOVMAA5VXe1PbSBL/2/oUzaBCOGVZNix7WXOmjoATXEtiFkztVYXkSlhj
! Chromebook C720 ~/.Xmodmap
! Huan Truong - 2014
! = <1:Key> <2:Shift+Key> <3:mode_switch+Key> <4:mode_switch+Shift+Key> <5:AltGr+Key> <6:AltGr+Shift+Key> <7:Ctrl+Alt+Key>
! Clear both Alt keys mapping
clear Mod1
add mod1 = Alt_L
! Make the right alt key to be the mode switch key
keycode 108 = Mode_switch
@htruong
htruong / WAN-UP
Created May 16, 2014 23:45
Tomato Adblock LITE script
PREFIX="/tmp/adblock/" ## adjust this!
mkdir $PREFIX
echo '
PIXEL_IP="0" ## 0: disable pixelserv
PIXEL_OPTS=""
BRIDGE="br0"
RAMLIST="1" ## 1: keep blocklist in RAM (e.g. for small JFFS)
CONF="/etc/dnsmasq.custom" ## dnsmasq custom config
SOURCES="$SOURCES http://winhelp2002.mvps.org/hosts.txt"
// MaxProduct solution
// Huan Truong
// For those who are too lazy to think, like me
int maxProduct(int* nums, int numsSize) {
int bestSoFar = nums[0];
// Max magnitute product we have in a single "segment"
int maxp = nums[0];
// Smallest magnitute product we have
int minp = nums[0];
@htruong
htruong / gist:61a7d4ec3f4c2f481997
Created February 11, 2016 06:13
Notes on setting up Chromebook 13
#Edit this so that the default volume doesn't blow your head off
/usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common
[Element Speaker]
switch = mute
volume = ignore
[Element PCM]
switch = mute
@htruong
htruong / gist:368870d67dbc9097b0c6b57553506ec8
Last active April 10, 2016 03:20
HAB.education - OpenWRT image
vim files/etc/uci-defaults/set-wifinetwork.sh
#!/bin/sh
uci set wireless.@wifi-device[0].disabled=0
uci set wireless.@wifi-iface[0].ssid="HAB.education Classroom Wireless"
uci set wireless.@wifi-iface[0].encryption=psk2
uci set wireless.@wifi-iface[0].key="spacecadet"
uci commit wireless
exit 0
/*
Button / SolderingIronBOff
Automatically turns off soldering station.
Turns on the power switch tail (also the LED)
connected to digital pin 1.6,
when pressing a pushbutton attached to pin 2.
Automatically times out when it reaches a threshold.