Skip to content

Instantly share code, notes, and snippets.

🔒
Connection is secure

WindProphet WindProphet

🔒
Connection is secure
View GitHub Profile
@WindProphet
WindProphet / proxy.go
Last active May 11, 2018 — forked from chopachom/proxy.go
Simple TCP proxy in Golang
View proxy.go
package main
import (
"flag"
"fmt"
"io"
"net"
)
var localAddress *string = flag.String("l", "localhost:9999", "Local address")
@WindProphet
WindProphet / login.lua
Created Apr 20, 2018
auto login XJTU student network
View login.lua
#!/usr/bin/env lua
-- login.lua auto login XJTU student network
-- Prerequisite: luasocket, luaposix
info = {
username = 'THIS IS USERNAME';
password = 'THIS IS PASSWORD';
}
string.split = function (pString, pPattern)
@WindProphet
WindProphet / linesticker.py
Created Apr 8, 2018
Get LINE Sticker from Webpage
View linesticker.py
#!/usr/bin/env python3
'Get LINE Sticker'
import requests
import re
import os
import shutil
from urllib.parse import urlparse
from bs4 import BeautifulSoup
@WindProphet
WindProphet / codeset.rb
Last active Dec 29, 2017
Encode set changing methods
View codeset.rb
#!/usr/bin/env ruby
# Codeset changing methods
begin
require 'rchardet'
rescue LoadError
end
module CodesetChange
@WindProphet
WindProphet / keypress.rb
Created Jan 15, 2017 — forked from acook/keypress.rb
Read keypresses from user in terminal, including arrow keys using pure Ruby. This has since been folded into a much more robust gem called Remedy. https://rubygems.org/gems/remedy & https://github.com/acook/remedy
View keypress.rb
require 'io/console'
# Reads keypresses from the user including 2 and 3 escape character sequences.
def read_char
STDIN.echo = false
STDIN.raw!
input = STDIN.getc.chr
if input == "\e" then
input << STDIN.read_nonblock(3) rescue nil
@WindProphet
WindProphet / Contacts.applescript
Last active Jan 7, 2017
Check Mac Contacts to add +86 before Chinese phone number and add pinyin for Chinese name
View Contacts.applescript
#!/usr/bin/osascript
set change to true -- if you need change the Contacts, toggle it to TRUE
(*turn Chinese characters to pinyin*)
on pinyin(chars)
(*python3 pypinyin needed*)
return do shell script "echo '"&chars&"' | /usr/local/bin/python3 -c 'from pypinyin import pinyin, lazy_pinyin;print(\"\".join([a.capitalize() for a in lazy_pinyin(input())]))'"
end
tell application "Contacts"
(*get every person of Contact*)
set persons to people
View github.py
from requests import request
from pprint import pprint as p
import re, json
"GitHub API Python"
import configparser
config = configparser.ConfigParser()
config.read('config.txt')
API = config['github']['api']
@WindProphet
WindProphet / texify.rb
Last active Oct 5, 2016
Input TeX textfile or zip archive and output pdf file
View texify.rb
#!/usr/bin/env ruby
$files = STDIN.read
randir = (0...31).map { (65 + rand(26)).chr }.join
class String
def black; "\e[30m#{self}\e[0m" end
def red; "\e[31m#{self}\e[0m" end
def green; "\e[32m#{self}\e[0m" end
View install-shadowsocks-python.sh
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
random_string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
View truetypefont.swift
//:# Playground - TrueType Font Analysis
import Cocoa
import XCPlayground
var char: Character = ""
var font = CTFontCreateWithName("Weibei SC", 100, nil)
func findGlyph(str: String, font: CTFont) -> CGGlyph {
You can’t perform that action at this time.