Skip to content

Instantly share code, notes, and snippets.

View tigerhawkvok's full-sized avatar

Philip Kahn tigerhawkvok

View GitHub Profile
@tigerhawkvok
tigerhawkvok / .gitconfig
Last active May 27, 2021 00:08 — forked from joechrysler/who_is_my_mummy.sh
Find the nearest parent branch of the current git branch
[alias]
parentalt = "!git show-branch | grep '*' | grep -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//' #"
parent = "!vbc=$(git rev-parse --abbrev-ref HEAD) && vbc_col=$(( $(git show-branch | grep '^[^\\[]*\\*' | head -1 | cut -d* -f1 | wc -c) - 1 )) && swimming_lane_start_row=$(( $(git show-branch | grep -n \"^[\\-]*$\" | cut -d: -f1) + 1 )) && git show-branch | tail -n +$swimming_lane_start_row | grep -v \"^[^\\[]*\\[$vbc\" | grep \"^.\\{$vbc_col\\}[^ ]\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//'"
@tigerhawkvok
tigerhawkvok / ImageDeTiler.py
Last active September 5, 2024 06:26 — forked from will-hart/README.md
Stitch together tilemaps into a single image
#!python3
"""
A simple script which converts all the images in
the folder it is run from into a single image.
Images should be in a directory <searchDir>, with
the tiles binned into folders based on their
Y-axis identity, named as their X-axis identity.
In other words, they should be folders of rows
containing column-items for that row of images.
@tigerhawkvok
tigerhawkvok / file_get_contents_curl.php
Last active September 21, 2018 22:36
cURL replacement for file_get_contents()
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
# Actual fetch
$data = curl_exec($ch);
<!-- BROWSE HAPPY BEGINS HERE -->
<style>
.browsehappy {
display:block;
width:100%;
height:100px;
background-color:#f2dede;
margin: 0 0 10px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 22px;