Skip to content

Instantly share code, notes, and snippets.

@pabranch
pabranch / git-stop-tracking-remote-branch.md
Created July 13, 2018 23:52 — forked from magnusbae/git-stop-tracking-remote-branch.md
How to make Git stop track a remote branch without deleting the remote branch.

You don't have to delete your local branch.

Simply delete your remote tracking branch:

git branch -d -r origin/<remote branch name> (This will not delete the branch on the remote repo!)

See "Having a hard time understanding git-fetch"

there's no such concept of local tracking branches, only remote tracking branches.

@pabranch
pabranch / HowToOTGFast.md
Created August 15, 2017 14:07 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

###Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)
More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is

@pabranch
pabranch / properties-expander.sh
Created January 3, 2017 17:55 — forked from emmanuelbernard/properties-expander.sh
Expand properties in bash
#!/bin/bash
#
# Released under the WTFPL license version 2 http://sam.zoy.org/wtfpl/
# Copyright (c) 2012 Emmanuel Bernard
# -----
# Usage: properties-expander.sh <properties file> <template> <destination>
#
# Properties file:
# PROPERTY1=value1
# PROPERTY2=value2
@pabranch
pabranch / gist:c16706584f1d46a45b45b7df74d43680
Last active December 6, 2016 22:15 — forked from blalor/gist:5527096
redhat → debian, arch rosetta stone
rpm yum debian arch
rpm -i foo.rpm dpkg -i foo.deb pacman -U foo.pkg.tar.xz
yum install foo apt-get install foo pacman -S foo
rpm -e foo yum remove foo dpkg -P foo pacman -R foo
rpm -qip foo.rpm dpkg -I foo.deb pacman -Qi -p foo.pkg.tar.xz
yum info foo apt-cache show foo pacman -Si foo
rpm -qlp foo.rpm dpkg -c foo.deb pacman -Ql -p foo.pkg.tar.xz
rpm -ql foo

TodoMVC React

Using Optional from Java 8

References

Null check w/ Default

# First
git fetch
git checkout origin/master -b my-stuff
# initial changes
git add
git commit -m 'summary message'
# continued work
git commit --amend
# First
git fetch
git checkout origin/master -b my/feature
git push -u
# Work
commit
commit
git fetch
# First
git fetch -avp
git checkout origin/master -b my/feature
# Work
commit
commit
git push && git pull --rebase && git push -f
@pabranch
pabranch / rot.py
Created March 21, 2016 22:21 — forked from terrorbyte/rot.py
Classic ROT substitution cipher in python, with a twist. Supports ROT13, ROT47, ROT 0x8000 (UTF-8 version), ROT 0x80000 (UTF-16), and Frobnicate (XOR with 42 used in Linux memfrob).
#!/bin/env python
import argparse
#bin(ord(u'联'))
#chr(0b1000000001010100)
#bin(ord(u'联') ^ 0x8000)
#bin(ord(u'T') ^ 0x8000)
#Frobnicate a string
def frobnicate(s):