Skip to content

Instantly share code, notes, and snippets.

View vvoody's full-sized avatar

vvoody vvoody

  • Shanghai, China
View GitHub Profile
@vvoody
vvoody / portping.go
Last active January 9, 2018 03:03
portping - connect to massive ip:port addresses and find out what are not connectable
/*
Connect to massive ip:port addresses and find out what are not connectable.
Port variant of PingInfoView.
It only accepts input from a CSV file with following format:
10.12.15.121:8080,xxxxx,zzzzzz
10.12.15.4:8080,aaaaa,bbbbbb
10.12.15.35:8080,ddddd,eeeeee
...

Keybase proof

I hereby claim:

  • I am vvoody on github.
  • I am vvoody (https://keybase.io/vvoody) on keybase.
  • I have a public key ASBvWpZB4yG0XpD8OLiRHwDezW9GWiFromZ30cy3Tz1loQo

To claim this, I am signing this object:

@vvoody
vvoody / com.foobar.ifconfiglo.plist
Created April 26, 2017 07:00
ifconfig alias loopback on macOS startup
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.foobar.ifconfiglo</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/ifconfig</string>
@vvoody
vvoody / subtitle_downloader.py
Created November 17, 2016 08:49 — forked from ihciah/subtitle_downloader.py
Xunlei subtitle downloader
#!/usr/bin/python
# -*- coding: utf-8 -*-
# __author__ = 'ihciah'
# cid_hash_file function from https://github.com/binux/lixian.xunlei/blob/master/libs/tools.py
import hashlib
import inotify.adapters
import os
import requests
import re
@vvoody
vvoody / curl.php
Created November 15, 2012 20:43
php curl remote
<?php
$ch = curl_init("https://api.twitter.com/");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Encoding: gzip"));
header ("Content-Encoding: gzip");
$data = curl_exec($ch);
curl_close($ch);
/*
* wrapper of running shell script as given user
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, char *argv[])
@vvoody
vvoody / readcookies.py
Created April 5, 2012 07:25 — forked from gwarser/readcookies.py
Opera cookies4.dat reader
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import print_function
import os, sys
import struct as st
import time as tm
uint32 = '>I'
int32 = '>i'
@vvoody
vvoody / find_palindrome_date.py
Created November 2, 2011 12:30
find palindrome date
#!/usr/bin/python
# -*- coding: utf-8 -*-
# find palindrome dates from today
# One date is same whatever you read it from left or right,
# like "20111102", "20200202"... we'll call it palindrome date.
import datetime
today = datetime.datetime.today()
@vvoody
vvoody / gist:929925
Created April 19, 2011 22:59
rewrite my old wordpress blog urls to new
# part of /etc/nginx/nginx.conf
server {
listen 80;
server_name vvoody.org;
location ~ /blog[/]?$ {
if ($query_string ~ p=([0-9]+)) {
rewrite ^(.*) http://blog.vvoody.org/article/$arg_p? permanent;
#set $article_id $1;
@vvoody
vvoody / table_dependencies.py
Created January 17, 2011 09:40
generate raw table relations and sort by 'tsort' later
#!/usr/bin/python
# use PostgreSQL for example
import pgdb
def get_namespace_oid(db, name):
cx = db.cursor()
cx.execute('SELECT oid FROM pg_namespace WHERE nspname=%s', (name,))
row = cx.fetchone()
cx.close()