Skip to content

Instantly share code, notes, and snippets.

@vivisidea
vivisidea / Install NVIDIA Driver and CUDA.md
Created April 4, 2018 16:07 — forked from zhanwenchen/Install NVIDIA Driver and CUDA.md
Install NVIDIA CUDA 8.0 on Ubuntu 16.04.3 LTS
@vivisidea
vivisidea / ss
Last active April 15, 2017 16:36
simple script to choose the BEST shadowsocks server from serveral ips
#!/bin/bash
#
# simple script to choose the BEST shadowsocks server from serveral ips
# by wq.yang@2015-10-20
#
TEST_RESOURCES="https://www.google.co.jp/webhp?hl=en&gws_rd=cr&ei=PEZHVoWJOeS9mgXD2ro4#hl=en&q=google \
https://twitter.com/ \
https://www.facebook.com/?_rdr=p
"
LOG_FILE="/tmp/ss.log"
@vivisidea
vivisidea / JPGToText.java
Created September 27, 2014 15:45
bilibili.tv using char to draw a jpeg image
package bilibili.tv;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
@vivisidea
vivisidea / gist:0b17eb78be7c45d032f6
Created September 13, 2014 02:52
simple shell script to find the min-average ping rtt time from multiple ips
#!/bin/bash
# file: ping-shortest
# created by make-template :)
# vivi@2014-06-29_18:16:12
ipfile=ips.txt
tmp=ping-ip-tmp.txt
while read IP; do
average=`ping -nq -w 1 -i 0.2 -c 3 $IP | grep rtt | cut -d '/' -f 5`
if [ "X$average" == "X" ]; then
@vivisidea
vivisidea / goagetn.init.sh
Created January 18, 2014 11:42
smiple script to manage goagent proxy v1.1
#!/bin/bash
#
# smiple script to manage goagent proxy
#
root=~/scripts
localroot=$root/goagent/local
log=$root/goagent.log
is_running(){
@vivisidea
vivisidea / .vimrc
Last active December 21, 2015 01:49
.vimrc
set fileencodings=gb18030,utf-8,default
set fileencoding=utf8
set encoding=utf8
set formatoptions+=m
set formatoptions+=B
" --------------------------------------------------------------------------------
" configure editor with tabs and nice stuff...
" --------------------------------------------------------------------------------
@vivisidea
vivisidea / gist:5743279
Last active December 18, 2015 06:59
switchy sharp rule list
; vivisidea's proxy site list
; Date: 1/20/2014
#BEGIN
[wildcard]
; google sites related
*://*google.com*
*://*youtube.com/*
*://*gstatic.com/*
@vivisidea
vivisidea / convert-enc.py
Created March 31, 2013 09:37
linux's iconv tool SUCKS when processing Chinese character building my own simple file encoding conversion tools using python. make sure you know the original encoding
#!/usr/bin/env python
# -*- encoding=utf-8 -*-
#
# convert files from encoding to another encoding
#
import os
directory = '.'
surfix='.txt'
fromenc='gbk'
@vivisidea
vivisidea / ssh.proxy.sh
Created March 4, 2013 03:50
a simple script to connect ssh.proxy server automatically.
#!/bin/bash
# file ssh.proxy
# created by make-template :)
# vivi@2012-02-20_21:30:05
#
# a simple script to connect ssh.proxy server at startup
# and handle the broken pipe error automatically
#
ROOT=$HOME/scripts/ssh.proxy
@vivisidea
vivisidea / hilight-html-text.js
Created February 4, 2013 06:03
a simple javascript function to hilight text without breaking html tag, for example: hilight 'google' in '<a href="google.com">google</a>' --> '<a href="google.com"><span class="hilight">google</span></a>'
/** 带有html文本的关键词高亮 */
var hilight = function(input, word){
var splits = split(input);
for(i = 0; i<splits.length; i++){
if(splits[i][0] === '<' && splits[i][splits[i].length-1] ==='>') continue;
splits[i] = splits[i].replace(new RegExp(word, 'gi'), '<span class="hilight">'+word+'</span>');
}
return splits.join('');
}