Skip to content

Instantly share code, notes, and snippets.

View joec4i's full-sized avatar
🎯
Focusing

Joe Cai joec4i

🎯
Focusing
  • Sydney, Australia
View GitHub Profile
@joec4i
joec4i / pin_code.sh
Last active January 3, 2016 16:19
Cracked Samsung Galaxy Note II pin code for a friend. Luckily it has usb debug turned on. And I just love bash one-liners.
for i in $(seq 0 9999); do x=$(printf %04d $i); echo $x; adb shell input text $x; adb shell input tap 540 360; done
@joec4i
joec4i / gist:dd852c1e566c62a76703
Created August 21, 2014 01:47
Simulate events for easier PhoneGap development
var eventName = 'offline';
var event = document.createEvent('Event');
event.initEvent(eventName, true, true);
document.dispatchEvent(event);
@joec4i
joec4i / ios_devices.sh
Created November 3, 2014 00:15
Move the last column to the head of each line with awk
cat devices.txt | awk '{lc=$NF; $NF=""; print lc"\t"$0}'
@joec4i
joec4i / gist:42e3d7055d84e19237c9
Created November 11, 2014 23:04
JAVA_HOME for mac
export JAVA_HOME=$(/usr/libexec/java_home)
@joec4i
joec4i / ctags.sh
Last active August 29, 2015 14:09
#!/bin/bash
ctags -h ".php" -R \
--tag-relative=yes \
--totals=yes \
--exclude=".git" \
--exclude=".js" \
--exclude=".twig" \
--exclude=".css" \
--exclude="web/images" \
@joec4i
joec4i / .gitconfig
Last active August 29, 2015 14:09
.gitconfig
[user]
name = User Name
email = username@example.com
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
@joec4i
joec4i / Vagrantfile
Last active June 16, 2018 06:10
A vagrant vm cluster for kubernetes
# -*- mode: ruby -*-
# vi: set ft=ruby :
hosts = {
"master" => {
:ip => "192.168.66.10",
:cpus => 1,
:memory => 1024
},
"node1" => {
@joec4i
joec4i / glusterfs.md
Last active June 16, 2018 17:42
Setting up GlusterFS on Vagrant for Kubernetes
# Setting up GlusterFS on Vagrant for Kubernetes
Note that since this is only a setup for local testing, there is no redundancy or authentication configuration.
* The Vagrantfile for a two-node set-up
```
# -*- mode: ruby -*-
# vi: set ft=ruby :
hosts = {
package main
import "fmt"
var letterValuesConfig = map[string]int{
"AEIOULNRST": 1,
"DG": 2,
"BCMP": 3,
"FHVWY": 4,
"K": 5,
@joec4i
joec4i / delete-versioned-s3-bucket.py
Created August 8, 2019 12:58
A Python script to delete s3 bucket with object versions
import boto3
boto3.set_stream_logger('boto3.resources.action')
session = boto3.Session()
s3 = session.resource(service_name='s3')
bucket = s3.Bucket('bucket-name')
bucket.object_versions.delete()
bucket.delete()