Skip to content

Instantly share code, notes, and snippets.

Avatar
🐈
Cataholic

Ash Wu hSATAC

🐈
Cataholic
View GitHub Profile
@hSATAC
hSATAC / install redis-cli.sh
Created June 7, 2022 05:15
Install redis-cli with tls in alpine
View install redis-cli.sh
export REDIS_VERSION="6.0.4"
export REDIS_DOWNLOAD_URL="http://download.redis.io/releases/redis-${REDIS_VERSION}.tar.gz"
apk add --update --no-cache --virtual build-deps gcc make linux-headers musl-dev tar openssl-dev pkgconfig
wget -O redis.tar.gz "$REDIS_DOWNLOAD_URL"
mkdir -p /usr/src/redis
tar -xzf redis.tar.gz -C /usr/src/redis --strip-components=1
cd /usr/src/redis/src
make BUILD_TLS=yes MALLOC=libc redis-cli
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}'))
@hSATAC
hSATAC / tmate-slave-ubuntu-1604.md
Created December 11, 2018 16:17 — forked from xinzweb/tmate-slave-ubuntu-1604.md
Tmate-slave on Ubuntu 16.04
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 March 20, 2018 04:09
Send Mobi to Kindle on MacOS Terminal
View send_to_kindle.md
@hSATAC
hSATAC / gist:118d7a809b06c9b5d95ad78c99950460
Created July 27, 2016 18:05 — 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

@hSATAC
hSATAC / download_rds_log.rb
Created July 11, 2016 03:05
Download RDS log
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
@hSATAC
hSATAC / sf.rb
Created December 21, 2015 18:02
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 = {
'>' => '>',
'<' => '<',
'&' => '&'
}