Skip to content

Instantly share code, notes, and snippets.

@zazabe
zazabe / keybase.md
Last active September 10, 2019 22:07

Keybase proof

I hereby claim:

  • I am zazabe on github.
  • I am zazabe (https://keybase.io/zazabe) on keybase.
  • I have a public key ASC53Rb0v77Cqca-Tg6M1zBLJf6SPQucBEnGwOt2CUavMgo

To claim this, I am signing this object:

@zazabe
zazabe / recover.sh
Created March 29, 2019 04:20
recovery with wifi
ip link set wlp4s0 up
iw dev wlp4s0 scan | less
wpa_passphrase "ssid" "pwd" > /tmp/ssid.conf
wpa_supplicant -B -i wlp4s0 -c /tmp/ssid.conf -f /tmp/wpa.log
systemctl start systemd-networkd
systemctl start dhcpcd
ping google.com
@zazabe
zazabe / arch-install-mac.sh
Last active January 13, 2019 13:52
archlinux install - macbook pro
# install archlinux by using antergos live ISO (just to have a GUI with a browser)
modprobe brcmfmac
# https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system#LVM_on_LUKS
gdisk
# EFI: /dev/sda1 - 550M - EF00
# BOOT: /dev/sda2 - 550M - 8300
# LVM: /dev/sda3 - * - 8E00
@zazabe
zazabe / install-percona-playback.sh
Created December 6, 2017 12:23
How to install percona-playback
sudo apt-get install libtbb-dev libmysqlclient-dev libboost-program-options-dev libboost-thread-dev libboost-regex-dev libboost-system-dev libboost-chrono-dev pkg-config cmake build-essential libssl-dev git
mkdir install
cd install
git clone https://github.com/percona/percona-playback
cd percona-playback
mkdir build_dir
cd build_dir
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
sed -i 's#MYSQL_LIB-NOTFOUND#/usr/lib/x86_64-linux-gnu/libmysqlclient.so#g' CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
@zazabe
zazabe / collection_fields.js
Created September 28, 2017 08:49
List MongoDB collection fields
var collections = ["foo", "bar"];
collections.forEach(function (collection) {
print(collection + ':' + db[collection].count());
mr = db.runCommand({
"mapreduce" : collection,
"map" : function() {
for (var key in this) { emit(key, null); }
},
"reduce" : function(key, stuff) { return null; },
@zazabe
zazabe / docker-utils.sh
Last active July 25, 2017 09:09
bash helper functions for docker
#!/usr/bin/env bash
# usage: wait_services service1,serviceN,... [timeout=300]
# eg: wait_services mysql,elasticsearch,redis
function wait_services {
TIMEOUT=${2:-300}
echo "Waiting for "${1}" services..."
count=0
until ( _test_services "${1}" )
do
@zazabe
zazabe / http-logger.rb
Created May 31, 2017 08:37
minimal http server in ruby
#!/usr/bin/env ruby
require 'socket'
port = ARGV[0].to_i
logfile = ARGV[1].to_s
server = TCPServer.new('localhost', port)
loop do
@zazabe
zazabe / zshrc
Created March 24, 2017 08:57
zshrc
export LESS='-F -X -R -E'
export ZSH=$HOME/.oh-my-zsh
export EDITOR='vim'
ZSH_THEME="zazabe"
ENABLE_CORRECTION="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
plugins=(git)
source $ZSH/oh-my-zsh.sh
@zazabe
zazabe / zazabe.zsh-theme
Created March 15, 2017 16:37
ZSH custom theme
# README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
# In addition, I recommend the
# [Tomorrow Night theme](https://github.com/chriskempson/tomorrow-theme) and, if
# you're using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over
# Terminal.app - it has significantly better color fidelity.
@zazabe
zazabe / webvr-device-info.js
Last active March 13, 2017 16:45
Get WebVR device info
var getDeviceData = function() {
return navigator.getVRDisplays()
.then(function(devices) {
var device = devices[0];
var getInfo = function(obj) {
var info = {};
for(var name in obj) {
if(typeof obj[name] == 'object') {
info[name] = getInfo(obj[name]);
} else if (typeof obj[name] != 'function') {