Skip to content

Instantly share code, notes, and snippets.

View hSATAC's full-sized avatar
🐈
Cataholic

Ash Wu hSATAC

🐈
Cataholic
View GitHub Profile
@hSATAC
hSATAC / sf.rb
Created December 21, 2015 18:02
#!/usr/bin/env ruby
def upload_and_generate_mobi(source_file, output_file, title)
puts "Dealing #{source_file} ..."
# get key
key = `curl -s http://ebook.cdict.info/mobi/ | grep progress_key`.match(/progress_key=([a-zA-Z0-9]+)/)[1]
`curl -s "http://ebook.cdict.info/mobi/revalid.php?progress_key=#{key}"`
`curl -s \
# replace symbols
def rs(str)
return str if str.blank?
symbols = {
'>' => '>',
'<' => '<',
'&' => '&'
}
@hSATAC
hSATAC / gist:99bf00ea75443d3b4a15
Created September 21, 2015 11:38
Fix unable to mount boot
# Boot from USB...
mkdir /mnt/arch
cd /mnt/arch
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
chroot . /bin/bash
mount -a
pacman -S linux
@hSATAC
hSATAC / reviewer.sh
Last active August 19, 2019 09:13
Jenkins postbuild script assign github reviewer
#!/bin/bash
rand() {
echo $(( $1 * RANDOM / 32768 ))
}
rand_element () {
local -a th=("$@")
echo "${th[$( rand ${#th[@]} )]}"
}
reviewers=(hSATAC poga aar0nTw hanklin kerkerj)
@hSATAC
hSATAC / rand_element.sh
Created September 15, 2015 17:45
random element
#!/bin/bash
rand() {
echo $(( $1 * RANDOM / 32768 ))
}
rand_element () {
local -a th=("$@")
echo "${th[$( rand ${#th[@]} )]}"
}
@hSATAC
hSATAC / .gitignore
Last active August 29, 2015 14:28 — forked from monde/.gitignore
Micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.
Gemfile.lock
@hSATAC
hSATAC / boot2docker-nfs.rb
Last active September 24, 2015 10:28 — forked from mattes/boot2docker-nfs.rb
docker-machine/ boot2docker with NFS instead of vboxsf
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vZT32) my-machine123
# https://gist.github.com/hSATAC/ac91f6cdc88c5a12ed5a
require 'erb'
bootlocalsh = %Q(#/bin/bash
@hSATAC
hSATAC / uniqush-push
Last active August 29, 2015 14:20 — forked from couraudt/uniqush-push
#!/bin/sh
### BEGIN INIT INFO
# Provides: uniqush-push
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts uniqush-push
# Description: Starts Uniqush provides a unified push service for server-side notification to apps on mobile devices.
### END INIT INFO
package main
import (
"fmt"
"log"
"os"
"runtime"
"runtime/debug"
"runtime/pprof"
"strconv"
@hSATAC
hSATAC / new_gist_file_0
Created December 2, 2014 17:30
Install OSX vm in OSX
記錄一下步驟
1. 從 appstore 下載 OSX 安裝檔,不需要安裝
2. gem install iesd
3. iesd -i /Applications/Install\ OS\ X\ Mavericks.app -o Mavericks.dmg -t BaseSystem 做完會在家目錄多一個 Mavericks.dmg
4. 開一個 VirtualBox 虛擬機器,選 OSX Mavericks 建立好以後先不要開機,進入設定 > 系統 > 晶片組選 PIIX3 然後確定 EFI 有打勾