Skip to content

Instantly share code, notes, and snippets.

View brotich's full-sized avatar
🏠
Working from home

Brian Rotich brotich

🏠
Working from home
  • Nairobi,Kenya
View GitHub Profile
@brotich
brotich / gist:f14687d070a36566d26d8e592dccc684
Created October 8, 2020 08:00 — forked from philipz/gist:04a9a165f8ce561f7ddd
Debian ARM64 (Aarch64) image for QEMU
QEMU version: 2.2.0
HDD init: qemu-img create -f qcow debian8-arm64.img 10G

Netinstall initrd: http://ftp.ru.debian.org/debian/dists/jessie/main/installer-arm64/20150107/images/netboot/debian-installer/arm64/initrd.gz
Netinstall kernel: wget http://ftp.ru.debian.org/debian/dists/jessie/main/installer-arm64/20150107/images/netboot/debian-installer/arm64/linux

Netinstall start:
 qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 512 -kernel linux -initrd initrd.gz -append "root=/dev/ram console=ttyAMA0" -global virtio-blk-device.scsi=off -device virtio-scsi-device,id=scsi -drive file=debian8-arm64.img,id=rootimg,cache=unsafe,if=none -device scsi-hd,drive=rootimg -netdev user,id=unet -device virtio-net-device,netdev=unet -net user
@brotich
brotich / gist:8b99ed8b55c81fb5adf847682c19cb08
Created September 28, 2020 06:15 — forked from lemenkov/gist:2947110
How to convert from any video format to mkv with ffmpeg/libav w/o recompressing
# "-fflags +genpts" - add this to regenerate packet timestamps (in case of error "Can't write packet with unknown timestamp")
./ffmpeg -fflags +genpts -i "/media/nfs/Nostromo/video/Japan Sinks (Nihon Chinbotsu) 1973 - WMV/NihonChinbotsu_1973.wmv" -acodec copy -vcodec copy ~/Desktop/NihonChinbotsu_1973.mkv
@brotich
brotich / ReadMe.md
Created August 3, 2020 07:59
Update submoudlews in a repo

Simply try below command after you have added your submodules.

for git v 1.8.x

git submodule update --init --recursive --remote

for v1.7.x:

git submodule update --init --recursive or git pull --recurse-submodules
@brotich
brotich / fix-routes.sh
Last active January 3, 2020 09:51
fix vpn and docker conflct
#!/bin/bash
set -eu -o pipefail
# https://github.com/docker/libnetwork/issues/779#issuecomment-231727303
# this fixes docker unable to start due to ip address conflict
echo "Adding default route to $route_vpn_gateway with /0 mask..."
ip route add default via $route_vpn_gateway
@brotich
brotich / ReadMe.md
Created December 28, 2019 06:21
Print shell commands on start up

set up

  1. add to the .zshrc or .bashrc

sample output

c-f  Move forward
c-b  Move backward
c-p  Move up
c-n  Move down
c-a Jump to beginning of line
@brotich
brotich / curl.sh
Last active April 9, 2019 14:56 — forked from exAspArk/curl.sh
Test CORS with cURL
curl -I -X OPTIONS \
-H "Origin: http://EXAMPLE.COM" \
-H 'Access-Control-Request-Method: GET' \
http://EXAMPLE.COM/SOMETHING 2>&1 | grep -i 'Access-Control-Allow-Origin'
@brotich
brotich / children.sh
Created May 29, 2018 13:38
get docker images children
!#/usr/bin/env bash
# from https://stackoverflow.com/questions/36584122/docker-how-can-i-get-the-list-of-dependent-child-images
for i in $(docker images -q)
do
docker history $i | grep -q d69bc9d9b016 && echo $i
done | sort -u
@brotich
brotich / gitcheats.txt
Created January 16, 2018 21:21 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# get a list of all commit messages for a repo
git log --pretty=format:'%s'
# push changes to an empty git repository for the first time
git push --set-upstream origin master
# delete first 10 branches of remote excluding master

Keybase proof

I hereby claim:

  • I am brotich on github.
  • I am brotich (https://keybase.io/brotich) on keybase.
  • I have a public key ASCxtmBLb7Heg-iJN9uQEt3EFi_xzQq_6me03WWyP9wUPQo

To claim this, I am signing this object:

@brotich
brotich / README.md
Created September 14, 2017 11:28
convert time ago time to local time using offset

takes '3 hours 10 minutes ago' and convert to actual time