Skip to content

Instantly share code, notes, and snippets.

View shouya's full-sized avatar

shouya

  • Open for Hire!
  • UTC+9
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN8ieSxiwT5yHg/Cu9I9ELeF7fYGauHbBhZBsrFSaHqIZTKQtxrNacg712xMnYBgZcAjPHeE0fuWtIgchhSeBOkhEXYnHMzsgHs/Uben9ylkszEUtEDEfqcxmvOzIbXlb+GFp7OTbY/KQljLfejSQO386v9rADgtkdUZw7O/9hk14zC+Zyzo1vlb71KMzWxixgf90cQp0zeft1sbH2s+AAaXIEp4c20g8mPrWGKMcBoTkWDYkxIiKBCCaylQh8KrES1PhbKgWciXHTMpIaFfsf1e+sNPdDHCAYk8ozgB204rArnXASY6sKRYAXII0v78cq9rZV1SnKApv7uDpfnIL7
@shouya
shouya / translate.rb
Last active April 20, 2017 04:59
DOM 全文翻譯試驗
# frozen_string_literal: true
require 'nokogiri'
require 'rest-client'
require 'json'
require 'securerandom'
require 'byebug'
PRESERVING_TAGS = ['code', 'pre']
SOGOU_TRANSLATE_PRIVATE_API = 'http://XXXXXX'
/*****************
* cellBlockA.js *
*****************
*
* Good morning, Dr. Eval.
*
* It wasn't easy, but I've managed to get your computer down
* to you. This system might be unfamiliar, but the underlying
* code is still JavaScript. Just like we predicted.
*
scptmux() {
[ -z "$1" ] && { echo "Usage: $0 <host>"; return }
rsync -arv \
--exclude='.tmux/resurrect' \
~/.tmux.conf ~/.tmux "$1:~"
}
complete -A hostname scptmux
tssh() {
ssh -v -o "RequestTTY=force" "$@" \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shouya
shouya / enc.sh
Last active August 21, 2017 05:35
#!/bin/bash
if [ "$#" != 1 -a "$#" != 2 ]; then
echo Usage:
echo 🔒: $0 "<file>"
echo 🔓: $0 "<file>" "<password>"
fi
if [ "$#" = 1 ]; then
file="$1"
@shouya
shouya / decoded.sh
Last active October 25, 2016 04:08 — forked from arisada/lnx-blaster2.sh
cat > root.c << EOF
int getuid(){ return 0;}
int geteuid(){return 0;}
int getgid(){return 0;}
int setuid(int n){return 0;}
int seteuid(){return 0;}
int setegid(int n){return 0;}
EOF
gcc -o ./root.so -shared root.c
@shouya
shouya / poi.sh
Last active November 20, 2015 14:14
quick poi.sh
#!/bin/bash
echo Installing packages
apt-key adv --keyserver hkp://pgp.mit.edu:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
codename=$(sh -c 'eval `cat /etc/lsb-release` && echo $DISTRIB_CODENAME')
echo deb https://apt.dockerproject.org/repo ubuntu-$codename main \
>> /etc/apt/sources.list.d/docker.list
apt-get update
@shouya
shouya / poi.sh
Last active November 2, 2015 08:25
poi setup script
#!/bin/bash
#
# This script belongs to shouya/poi project
# \bash <(wget -O - https://gist.githubusercontent.com/shouya/19c963b55d2ae0a516a8/raw/poi.sh)
#
set -e
EXTRA_APPS=(
@shouya
shouya / ngram.rb
Created June 28, 2015 22:37
an improved bigram word segmentating algorithm
def clean(txt)
mark = true
txt.each_char.map { |x|
if x.ascii_only? and mark
mark = false
' '
elsif x.ascii_only?
nil
else
mark = true