Skip to content

Instantly share code, notes, and snippets.

View OneOfOne's full-sized avatar
🐧
Focusing

Ahmed W. OneOfOne

🐧
Focusing
View GitHub Profile
@OneOfOne
OneOfOne / git-push-new
Created March 9, 2016 21:26
git push-new: pushes a new branch to remote and creates a pull request (uses hub)
#!/bin/sh
BRANCH=$(git symbolic-ref --short HEAD)
if echo $BRANCH | grep -q master; then
echo no master pushing
exit 1
fi
if git remote show -n origin | grep -q $BRANCH; then
git push "$@"
else
@OneOfOne
OneOfOne / client.conf
Last active March 18, 2016 19:47
a little script to handle connecting to an openvpn server and executing commands on top of that connection.
client
dev tun
proto udp
remote remote-server.com 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/myclienthost.crt
@OneOfOne
OneOfOne / pubsub.go
Created March 29, 2016 01:13
mangos bug dropping messages
package main
import (
"log"
"strconv"
"time"
"github.com/go-mangos/mangos"
"github.com/go-mangos/mangos/protocol/pub"
"github.com/go-mangos/mangos/protocol/sub"
@OneOfOne
OneOfOne / vpn-ssh.sh
Last active April 6, 2016 23:03
vpn over ssh setup script with pppd with ipv6 tunneling support
#!/bin/sh
if [[ $UID != 0 ]]; then
exec sudo $0 $@
exit $?
fi
USER=your-user-name
NAME=dev-name
SSHARGS="-C hostname" # remote host name, passed to ssh
@OneOfOne
OneOfOne / cpp-run.sh
Last active April 5, 2016 18:27
run c++ files and then clean up (go run for c++ with clang pretty much)
#!/bin/sh
fname="$(mktemp cpp-run.XXXXX)"
cppArgs=""
runArgs=""
doRun=0
doGDB=0
keep=0
for arg in "$@"; do
if [ "$arg" == "--" ]; then
@OneOfOne
OneOfOne / go.fish
Created May 6, 2016 16:51
go.fish, I amuse myself sometimes.
set -gx PATH $PATH "/usr/src/go/bin"
if test -d "$HOME/code/go"
set -xg GOPATH "$HOME/code/go"
set -xg PATH $PATH "$GOPATH/bin"
end
function rebuild-go
pushd /usr/src/go/src

Keybase proof

I hereby claim:

  • I am OneOfOne on github.
  • I am oneofone (https://keybase.io/oneofone) on keybase.
  • I have a public key whose fingerprint is BE3F 3BD5 4E48 EDD7 3E58 EE52 F3A4 E8B6 760B 7805

To claim this, I am signing this object:

@OneOfOne
OneOfOne / xonshrc.py
Last active July 30, 2020 02:16
my ~/.xonshrc
from builtins import __xonsh_env__
from subprocess import check_output, PIPE, CalledProcessError
from xonsh.tools import get_sep, XonshError
from os import listdir
from os.path import exists as pexists, join as pjoin, isfile
from collections import defaultdict, OrderedDict
def _branch_status(cwd=None):
branch = None
dirty = 0
@OneOfOne
OneOfOne / win7.sh
Created June 16, 2016 04:06
A bash script to start a windows 7 vm with with the web cam attached to use skype, because microsoft are horrible and forgot they have a Linux client.
#!/bin/sh
export QEMU_AUDIO_DRV=pa
DISKIMG=/mnt/data-7/qemu/win7/win7.img
WIN7IMG=
VIRTIMG=/media/storage/iso/virtio-win-0.1.118.iso
sudo chmod 666 /dev/bus/usb/$(lsusb | grep LifeCam | awk '{split($4,a,":"); print $2"/"a[1] }')
qemu-system-x86_64 --enable-kvm -drive file=${DISKIMG},format=raw,if=virtio,aio=native,cache=none -m 2048 \
-net nic,model=virtio -net user -rtc base=localtime,clock=host \
@OneOfOne
OneOfOne / git-push-new.sh
Last active November 29, 2021 22:44
git-push-new a little git helper to push a new branch and create a pull request.
#!/bin/bash
BRANCH=$(git symbolic-ref --short HEAD)
if echo $BRANCH | grep -q master; then
echo no master pushing
exit 1
fi
args=""
nopr=0
for arg in "$@"; do