Skip to content

Instantly share code, notes, and snippets.

View stanwu's full-sized avatar

Stan Wu stanwu

View GitHub Profile
@stanwu
stanwu / install_spotify.sh
Created January 23, 2016 14:16
test ubuntu 14.04 x64 OK
#!/bin/bash
# 1. Add the Spotify repository signing key to be able to verify downloaded packages
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
# 2. Add the Spotify repository
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list
# 3. Update list of available packages
sudo apt-get update
@stanwu
stanwu / Appending to HTML as String.md
Last active January 13, 2016 04:28
Appending to HTML (concatenation) as String

#Android#

Appending to HTML (concatenation) as String joining is not a good solution, but you can try this approach which will ensure that the html document's sanctity is not broken. Since you have the HTML document with you, it signifies you have control over that document and hence you should be able to do this which I am mentioning below.

  1. Create a function in HTML
@stanwu
stanwu / wbond-package-control-issues-1057.sh
Last active November 10, 2016 06:14
Auto Mirror channel_v3.json (Wbond Package-Control Issues #1057)
#!/bin/bash
byte=`curl -s https://packagecontrol.io/channel_v3.json | wc -c`
if [ $byte -gt 2000000 ]; then
echo "OK! mirror it"
cp channel_v3.json channel_v3.json-old
curl -s https://packagecontrol.io/channel_v3.json -o channel_v3.json
cmp -s channel_v3.json channel_v3.json-old
if [ $? == 0 ]; then
echo "We don't need update now"
@stanwu
stanwu / channel_v3.json
Last active January 6, 2016 21:01
Package Control channel_v3.json auto mirror
This file has been truncated, but you can view the full file.
{"repositories": ["https://bitbucket.org/jjones028/p4sublime/raw/tip/packages.json", "https://bitbucket.org/klorenz/sublime_packages/raw/tip/packages.json", "https://csch1.triangulum.uberspace.de/release/packages.json", "https://packagecontrol.io/packages_2.json", "https://packagecontrol.io/repository.json", "https://raw.githubusercontent.com/20Tauri/DoxyDoxygen/master/DoxyDoxygen.json", "https://raw.githubusercontent.com/Andr3as/Sublime-SurroundWith/master/packages.json", "https://raw.githubusercontent.com/AutoIt/SublimeAutoItScript/master/packages.json", "https://raw.githubusercontent.com/FichteFoll/sublime_packages/master/package_control.json", "https://raw.githubusercontent.com/Floobits/floobits-sublime/master/packages.json", "https://raw.githubusercontent.com/Harrison-M/indent.txt-sublime/master/packages.json", "https://raw.githubusercontent.com/Hexenon/FoxCode/master/packages.json", "https://raw.githubusercontent.com/Kaizhi/SublimeUpdater/master/packages.json", "https://raw.githubusercontent.com/Kasoki/
@stanwu
stanwu / CentOS-Base.repo
Last active January 4, 2016 09:19
CentOS 6.5 Yum source from NCHC
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
@stanwu
stanwu / gist:8833fcfb750596a63767
Created October 13, 2015 16:08 — forked from fiorix/gist:9664255
Go multicast example
package main
import (
"encoding/hex"
"log"
"net"
"time"
)
const (
@stanwu
stanwu / md5sum.go
Last active October 11, 2015 02:28
Try to clone Linux md5sum command to replace md5 command in the Mac OS X
package main
import (
"crypto/md5"
"fmt"
"io"
"os"
)
func ComputeMd5(filePath string) ([]byte, error) {
@stanwu
stanwu / drive.go
Created October 10, 2015 08:54
google drive list all of files with MD5 checksum
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@stanwu
stanwu / pybrowser.py
Last active August 29, 2015 14:21 — forked from kklimonda/pybrowser.py
import sys
from gi.repository import Gtk, Gdk, WebKit
class BrowserTab(Gtk.VBox):
def __init__(self, *args, **kwargs):
super(BrowserTab, self).__init__(*args, **kwargs)
go_button = Gtk.Button("go to...")
go_button.connect("clicked", self._load_url)
self.url_bar = Gtk.Entry()
@stanwu
stanwu / helloworld.py
Created April 29, 2015 01:56
helloworld.py
#!/usr/bin/env python
# example helloworld.py
import pygtk
pygtk.require('2.0')
import gtk
class HelloWorld: