Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈
Cataholic

Ash Wu hSATAC

🐈
Cataholic
View GitHub Profile
View bluetooth-restart.sh
#!/bin/bash
echo "Restarting bluetooth service..."
blueutil -p 0 && sleep 1 && blueutil -p 1
echo "Waiting bluetooth service to be restored..."
until blueutil -p | grep "1" >/dev/null; do sleep 1; done
echo "Searching for devices not connected..."
devices=($(blueutil --paired | grep "not connected" | awk -F '[ ,]' '{print $2}'))
View tmate-slave-ubuntu-1604.md

Install dependincies

apt-get install  git-core build-essential pkg-config libtool libevent-dev libncurses-dev zlib1g-dev automake libssh-dev cmake ruby

Install msgpack >= 1.2.0

git clone https://github.com/msgpack/msgpack-c.git
cd msgpack-c
cmake .
@hSATAC
hSATAC / send_to_kindle.md
Last active Mar 20, 2018
Send Mobi to Kindle on MacOS Terminal
View send_to_kindle.md
@hSATAC
hSATAC / gist:118d7a809b06c9b5d95ad78c99950460
Created Jul 27, 2016 — forked from afair/gist:3803895
PostgreSQL and Pgpool Architecture
View gist:118d7a809b06c9b5d95ad78c99950460

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture

View download_rds_log.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'aws-sdk-core'
require 'pp'
Aws.config.update({
:access_key_id => ENV["AWS_ACCESS_KEY"],
:secret_access_key => ENV["AWS_SECRET_KEY"],
:region => 'ap-northeast-1'
})
View gist:52e92952b9e3a3265e34
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
highlight_base_name=0
highlight_megabytes=1
View sf.rb
#!/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 \
View ccc.rb
# replace symbols
def rs(str)
return str if str.blank?
symbols = {
'>' => '>',
'<' => '<',
'&' => '&'
}
@hSATAC
hSATAC / gist:99bf00ea75443d3b4a15
Created Sep 21, 2015
Fix unable to mount boot
View gist:99bf00ea75443d3b4a15
# 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