Skip to content

Instantly share code, notes, and snippets.

View citrus-lemon's full-sized avatar
🐟
fish-touching

Lemon citrus-lemon

🐟
fish-touching
  • Indeed, Inc.
  • Tokyo
  • 09:30 (UTC +09:00)
View GitHub Profile
# IPsec in Cent OS7
https://github.com/travislee8964/L2TP-VPN-installation-script-for-CentOS-7
# Shadowsocks auto install
var url = "";
var PUZZLE_DIFFICULTY_x = 4;
var PUZZLE_DIFFICULTY_y = 4;
var PUZZLE_HOVER_TINT = '#009900';
var _canvas;
var _stage;
var _img;
from __future__ import division
import copy
import math
import pyPdf
import sys,os
# import pyPdf.generic.RectangleObject as rr
def split_pages(src, dst):
src_f = file(src, 'r+b')
//:# 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 {
#!/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
}
@citrus-lemon
citrus-lemon / texify.rb
Last active October 5, 2016 15:09
Input TeX textfile or zip archive and output pdf file
#!/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
@citrus-lemon
citrus-lemon / github.py
Created December 3, 2016 10:14
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']
@citrus-lemon
citrus-lemon / Contacts.applescript
Last active January 7, 2017 14:46
Check Mac Contacts to add +86 before Chinese phone number and add pinyin for Chinese name
#!/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
@citrus-lemon
citrus-lemon / keypress.rb
Created January 15, 2017 01:24 — 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
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
@citrus-lemon
citrus-lemon / codeset.rb
Last active December 29, 2017 02:28
Encode set changing methods
#!/usr/bin/env ruby
# Codeset changing methods
begin
require 'rchardet'
rescue LoadError
end
module CodesetChange