Skip to content

Instantly share code, notes, and snippets.

Huang, Tao UniIsland

Block or report user

Report or block UniIsland

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
@UniIsland
UniIsland / xargs_with_function.sh
Last active Feb 10, 2018
use xargs with bash function
View xargs_with_function.sh
#!/bin/bash
parse_and_echo() {
echo "\$1:$1 \$2:$2 \$3:$3 \$4:$4"
echo newline
}
export -f parse_and_echo
# `_' is placeholder for $0
@UniIsland
UniIsland / zhihu-topic_bind_shortcut.js
Created Feb 10, 2018
Tampermonkey Script for 知乎话题快捷绑定(知乎问答页改版后已不再可用)
View zhihu-topic_bind_shortcut.js
// ==UserScript==
// @name zhihu - 快捷话题绑定
// @namespace http://www.zhihu.com/
// @version 0.1
// @description enter something useful
// @match http://www.zhihu.com/question/*
// @copyright 2012+, You
// ==/UserScript==
var topics = [[220,'知乎社区'],[33917,'个人咨询'],[87436,'成人内容'],[1309,'调查类问题']];
@UniIsland
UniIsland / linode_dns_updater.rb
Created Feb 10, 2018
update linode dns record with ruby
View linode_dns_updater.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'linode'
api_key = '<API_KEY_STRING>'
domain_id = 123456 # Domain ID
resource_id = 7654321 # Resource ID
new_ip = `ifconfig | grep "inet " | grep -v '127.0.0'`.split(' ')[1]
@UniIsland
UniIsland / moving_average.r
Created Feb 10, 2018
Calculate Moving Average with R
View moving_average.r
## calculating moving average
## x: data vector
## n: use how many samples
## s: 1 - with lag; 2 - symmetrically
f.ma <- function(x,n=5,s=2){filter(x,rep(1/n,n), sides=s)}
@UniIsland
UniIsland / simple-cors-http-server.py
Created Feb 10, 2018
Simple Python HTTP server with CORS (or other custom) header.
View simple-cors-http-server.py
#!/usr/bin/env python
# Attribution: https://stackoverflow.com/questions/21956683/enable-access-control-on-simple-http-server
try:
# Python 3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test as test_orig
import sys
def test (*args):
test_orig(*args, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
@UniIsland
UniIsland / gist:f43f73ee09c821740c36
Last active Aug 29, 2015 — forked from bobisme/gist:1078482
Build/install custom linux kernel headers with Debian.
View gist:f43f73ee09c821740c36

Linux Headers

  • Install tools to build:
sudo apt-get update
sudo apt-get install kernel-package fakeroot wget bzip2
  • Linux-2.6.39.1-linode34 is same as regular 2.6.39
@UniIsland
UniIsland / README.md
Last active Mar 16, 2017
Mnemonic Wordlist
View README.md

This word list is recommended by MNX.io in the article A Proper Server Naming Scheme.

Usage

Choose a word at will from the word list below.

The easiest way to randomly get a word from the wordlist on Linux is:

shuf -n 1 $FILENAME
@UniIsland
UniIsland / chenghao_invitations.md
Last active Feb 19, 2020
程浩在知乎上发出的问题邀请,共有 75 题。
View chenghao_invitations.md
Link Title
19698337 在知乎回答问题,你习惯先看其他人的答案再回答问题,还是直接回答?
19871031 网上有免费的盗版电子书下载看,你还会去买正版电子书吗?为什么?
20113000 有一个人有奇怪的色盲,但他不知道跟别人不一样,别人看到的天空是蓝色的,他看到的是绿色的,但是他和别人的叫法都一样,都是“蓝色”;怎么让他知道自己和别人不一样?你怎么证明你不是上述问题中的主人公?
20352045 看过很多书或者文章,关上之后,往往只记得大概讲什么,重点内容很难举出一二。怎样改善这种情况,提高记忆力?
20580216 读张爱玲是否要比读张小娴高档?是或者不是的理由是什么?
20699314 读书时想听点纯音乐,诸如贝多芬、德彪西等,可是一点不了解,有哪些唱片或者合辑值得推荐么?
20702339 马小弱是谁?
20703864 问张佳玮同学:除了摘抄、写读后感和写书评之外,还有什么样的读书笔记格式,可以高度浓缩一部长篇小说的思想性与主要内容?
@UniIsland
UniIsland / list-manually-installed-packages.sh
Created Feb 8, 2014
List all manually installed packages on a debian/ubuntu system
View list-manually-installed-packages.sh
#!/bin/bash
## List all manually installed packages on a debian/ubuntu system
## manually installed means:
## 1. not pre-installed with the system
## 2. not marked auto-installed by apt (not dependencies of other
## packages)
## Note: pre-installed packages that got updated still needs to be
## filtered out.
@UniIsland
UniIsland / files.txt
Last active Dec 31, 2015
find and remove large file from git history
View files.txt
135207 columns/static/img/ggj/c1.png
122010 columns/static/img/ggj/c2.png
144015 columns/static/img/ggj/c3.png
121790 sites/management/commands/invitation_code.txt
121795 sites/management/commands/invitation_code.txt
121800 sites/management/commands/invitation_code.txt
121805 sites/management/commands/invitation_code.txt
210125 sites/static/img/1.jpg
131079 sites/static/img/2.jpg
109902 sites/static/img/2011-ggj/daminghu.png
You can’t perform that action at this time.