Skip to content

Instantly share code, notes, and snippets.

View william8th's full-sized avatar

William Heng william8th

  • william [at] williamheng [dot] com
  • London, United Kingdom
View GitHub Profile
@william8th
william8th / .zshrc
Created February 4, 2020 21:16
My custom zshrc
export PROMPT="%F{green}%n%f@%m %F{magenta}%~%f$ "
export CLICOLOR=1
export LS_COLORS="di=31;41:ln=31;41:so=31;41:pi=31;41:ex=31;41:bd=31;41:cd=31;41:su=31;41:sg=31;41:tw=31;41:ow=31;41:"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
setopt BEEP NO_AUTOLIST BASH_AUTOLIST NO_MENUCOMPLETE
@william8th
william8th / consumer.py
Last active March 15, 2019 15:12
Kafka Avro Consumer Python
from confluent_kafka.avro import AvroConsumer
from confluent_kafka.avro.serializer import SerializerError
c = AvroConsumer({
'bootstrap.servers': 'localhost:9092',
'group.id': 'groupid',
'schema.registry.url': 'http://127.0.0.1:8081'
})
c.subscribe(['reddit_posts'])
@william8th
william8th / dev-kafka.sh
Last active December 23, 2018 03:01
Dev Kafka Cluster
# Get license.json from Landoop
docker run -p 3030:3030 -p 9092:9092 -p 2181:2181 -p 3031:3031 --rm \
-e LICENSE="$(cat ./license.json)" \
-e SAMPLEDATA=0 \
-e KAFKA_AUTO_CREATE_TOPICS_ENABLE=false \
-e KAFKA_ADVERTISED_HOST_NAME=localhost \
landoop/kafka-lenses-dev
@william8th
william8th / arch-linux-installation
Created August 6, 2018 03:27
ArchLinux installation guide
# Boot into Live CD/USB
# Use UK keyboard
loadkeys uk
# Check partitions available
fdisk -l
# Use fdisk to format partitions
# o to overwrite the disk
# n to create new partition
@william8th
william8th / .tmux.conf
Last active April 30, 2024 17:03
Tmux open new pane in same directory
# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
@william8th
william8th / vim-plugins.txt
Created February 6, 2018 22:47
My Vim Plugins
vim-go
nerdtree
ctrlp
@william8th
william8th / .vimrc
Last active February 6, 2018 22:43
execute pathogen#infect()
syntax on
filetype plugin indent on
set number
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
@william8th
william8th / ViewController.swift
Created March 23, 2016 11:31
Change cache control headers
//
// ViewController.swift
// CacheDelegate
//
// Created by Heng, William (Mobile Developer) on 23/03/2016.
// Copyright © 2016 Heng, William (Mobile Developer). All rights reserved.
//
import UIKit
@william8th
william8th / .gitconfig
Last active March 19, 2023 00:07
My custom git config
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
@william8th
william8th / .bash_profile
Last active September 24, 2018 10:48
My custom bash profile
export PS1="\[\033[38;5;10m\]\u\[$(tput sgr0)\]\[\033[38;5;0m\]@\h:\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;135m\]\w\[$(tput sgr0)\]\[\033[38;5;0m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
export GOPATH="$HOME/Code/Go"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home"
export PATH="/usr/local/sbin:$GOPATH/bin:$JAVA_HOME/bin:$PATH"
alias ls='ls -Gfh'
alias mvnn='mvn -DskipTests=true'