Navigation Menu

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 / gcp-start-iap-tunnel-ssh-proxy-magic.sh
Last active February 14, 2024 12:33 — forked from netj/gcp-start-iap-tunnel-ssh-proxy-magic.sh
a nifty script for accessing with native SSH your IAP allowed Compute Engine instances
#!/usr/bin/env bash
# ~/.ssh/gcp-start-iap-tunnel-ssh-proxy-magic.sh
# a script to be used as SSH ProxyCommand to allow fully functional SSH access to any Google Cloud Compute Engine VMs allowing IAP access
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2022-10-31
# See also:
# - https://gist.github.com/netj/df4f9de1fefd254ab11979be7035b5d0/#readme
# - https://cloud.google.com/iap/docs/using-tcp-forwarding
#
@hSATAC
hSATAC / install redis-cli.sh
Created June 7, 2022 05:15
Install redis-cli with tls in alpine
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
#!/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

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
@hSATAC
hSATAC / gist:118d7a809b06c9b5d95ad78c99950460
Created July 27, 2016 18:05 — forked from afair/gist:3803895
PostgreSQL and Pgpool Architecture

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
#!/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'
})
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
#!/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 \