Skip to content

Instantly share code, notes, and snippets.

@venj
venj / processstrings.rb
Created July 30, 2012 09:29
Process language string file
#!/usr/bin/env ruby
f = open ARGV[0]
o = open "out.strings", "w+"
lines = f.readlines
lines.each_slice(3) do |para|
regex = /\/\* (.*) \*\//i
chn = para[0].strip.match(regex)[1]
i = para[1].index("=") + 1
@venj
venj / block.txt
Created August 2, 2012 05:11
txwb olympic block
dynamic.cloud.vip.xunlei.com##DIV[class="speac_notice_layer"]
t.qq.com##DIV[id="main_cmd_w"][class="main_cmd_w"]
t.qq.com##DIV[class="newsTips2 guess"]
t.qq.com##DIV[id="app_olypicCheer"][class="SC SC_lst2 SC_olpic_mod"]
t.qq.com##DIV[class="SC SC_lst2"]
t.qq.com##DIV[class="nv_head_wrap"]
t.qq.com##DIV[class="promoWrap"]
t.qq.com##DIV[id="oly-ctn2"][class="micro_olympic clear"]
t.qq.com##DIV[id="app_olypicCheer"]
t.qq.com##DIV[id="app_recStars"]
@venj
venj / me.venj.autossh.plist
Created August 5, 2012 02:46
Launch Agent Plist for autossh auto start.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.venj.autossh</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/autossh</string>
<string>-M</string>
@venj
venj / domready.js
Created August 6, 2012 07:17
DOM ready, the easiest way. For modern browsers.
document.addEventListener('DOMContentReady', function(){
// DOM ready.
});
@venj
venj / addrepo.sh
Created August 9, 2012 08:13
script to quick add a repo on local server.
#!/bin/bash
REPO_HOME=/home/git
CWDDIR=`pwd`
function usage() {
echo -e "Usage: \e[1;34m`basename $0`\e[0m RepoName1 [RepoName2 ...]"
}
function createrepo() {
@venj
venj / autocapcha.user.js
Created August 28, 2012 02:53
auto input capcha for you.
// ==UserScript==
// @name aotucapcha
// @namespace http://218.90.160.85:9090/bustravelguide/default.aspx
// @description Auto enter capcha
// @include http://218.90.160.85:9090/bustravelguide/default.aspx
// @version 1
// @grant none
// ==/UserScript==
document.addEventListener('DOMContentLoaded', function(){
@venj
venj / lixian.rb
Last active December 13, 2015 19:58
a test script for using xunlei-lixian python objects inside ruby.
#!/usr/bin/env ruby
require "rubygems"
require "rubypython"
require "digest"
RP = RubyPython
RP.start
username = ARGV[0]
@venj
venj / encode.rb
Created March 14, 2013 05:27
Convert videos (mjpeg) shot with Canon Powershot to m4v(h264).
#!/usr/bin/env ruby
require 'rubygems'
require 'colorize'
require 'shellwords'
Dir["*"].each do |f|
next if f == File.basename(__FILE__)
fname = File.basename(f.downcase, '.avi')
print "Encoding #{f}..."
system("ffmpeg -v error -i #{f.shellescape} -map_metadata 0:g -acodec libfaac -ab 256 -ar 44100 -ac 1 -c:v h264 #{fname}.m4v")
<?php
if ($_GET["shorturl"]) {
$short_url = $_GET["shorturl"];
$ch = curl_init($short_url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
/*
echo "<p>" . curl_getinfo($ch, CURLINFO_EFFECTIVE_URL) . "</p>";
@venj
venj / bypass.php
Created May 7, 2013 05:54
Bypass cloudflare. via http://pastebin.com/UG24rC0y (GFWed)
<form method="POST">
<title>Bypass CloudFlare</title>
<center>
</head>
<body>
<p align="center" dir="ltr"><b><font size="5" face="Tahoma">Bypass
<font color="#F68B1F">CloudFlare</font> !</font></b></p>
<select name="krz">
<option>ftp</option>
<option>direct-conntect</option>