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
  • 05:47 (UTC +09:00)
View GitHub Profile
@citrus-lemon
citrus-lemon / .emacs
Last active August 20, 2021 01:01
easy_emacs_config
(load-theme 'tango-dark)
(global-linum-mode 1)
(setq linum-format "%3d \u2502 ")
(electric-pair-mode 1)
(setq backup-directory-alist
`(("." . ,(concat user-emacs-directory "backups"))))
(setq auto-save-file-name-transforms
@citrus-lemon
citrus-lemon / proxy.go
Last active May 11, 2018 16:12 — forked from chopachom/proxy.go
Simple TCP proxy in Golang
package main
import (
"flag"
"fmt"
"io"
"net"
)
var localAddress *string = flag.String("l", "localhost:9999", "Local address")
@citrus-lemon
citrus-lemon / login.lua
Created April 20, 2018 01:40
auto login XJTU student network
#!/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)
@citrus-lemon
citrus-lemon / linesticker.py
Created April 8, 2018 13:14
Get LINE Sticker from Webpage
#!/usr/bin/env python3
'Get LINE Sticker'
import requests
import re
import os
import shutil
from urllib.parse import urlparse
from bs4 import BeautifulSoup
@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
@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 / 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 / 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 / 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
#!/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
}