Skip to content

Instantly share code, notes, and snippets.

View brettp's full-sized avatar

Brett Profitt brettp

View GitHub Profile
@kinoc
kinoc / trainLMS_pub.py
Last active October 26, 2020 16:01
Fine-tune GPT-2 1558M on a Titan RTX using IBM Tensorflow Large Model Support v2
#!/usr/bin/env python3
# Usage:
# PYTHONPATH=src ./train --dataset <file|directory|glob>
# Got 1558M to train on a TITAN RTX using IBM Tensorflow_Large_Model_Support
# TLMS can insert explicit swaps in the graph between GPU and CPU, to extend the memory
# But the graph has While_Loop, so you have to use the TFLMSv2 version (which works with TF 1.x)
#
# Download, expand, get the egg out and install.
@KurtJacobson
KurtJacobson / touchscreen_calibration.md
Last active February 27, 2024 22:06
Touchscreen calibration procedue for Debian9 (stretch)

Touchscreen Calibration in Debian9

Unfortunately [xinput-calibrator][1] does not work at all for calibrating a touchscreen in Debian9. This is apparently because X server now uses libinput to handle input devices instead of evdev. I spent huge amount of trying to fiddling with xinput-calibrator and 99-calibration.conf files until I finely found this [issue][2] on GitHub that gave me some hints as how to proceed. This is mostly for my own reference, but I hope it might also help others in the same situation.

@jvcleave
jvcleave / distccd-rpi.plist
Last active April 30, 2024 06:27
mac distcc install instructions
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>distccd-rpi</string>
<key>Program</key>
<string>/Users/YOUR_USER_NAME/Scripts/launchd-distccd.sh</string>
<key>RunAtLoad</key>
<true/>
@ubershmekel
ubershmekel / json_history_to_kml.py
Last active July 4, 2023 10:08
Convert LocationHistory.json from Google takeout of location history (latitude) to a usable KML file for viewing in Google Earth.
"""
Convert LocationHistory.json from Google takeout of location history (latitude)
to a usable KML file for viewing in Google Earth.
Usage:
python json_history_to_kml.py LocationHistory.json
@makasim
makasim / gist:3720535
Last active June 26, 2017 06:32
form partial bind
<?php
namespace Foo\CoreBundle\Form\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormInterface;
/**
* Changes Form->bind() behavior so that it treats not set values as if they
@brettp
brettp / android_stuff.md
Last active April 26, 2019 03:28
Copying the "SD card" contents between rooted Android devices that don't have a physical SD card using abd

Backup media partition

adb forward tcp:7080 tcp:8080
# from another terminal on same machine (or run adb cmd directly)
adb shell 'tar --exclude=/data/media/0/TWRP -Jcvf - /data/media | nc -p 8080 -l 1>/dev/null'

# original terminal
nc -w15 localhost 7080 &gt; media.tar.gz
@marijn
marijn / Example.php
Created April 3, 2012 16:53
An example on sorting Doctrine\Common\Collection\ArrayCollection elements
<?php
$collection = new Doctrine\Common\Collection\ArrayCollection();
// add objects to the collection that contain a getCreated method returning a DateTime instance
$iterator = $collection->getIterator();
$iterator->uasort(function ($first, $second) {
if ($first === $second) {
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@mrenouf
mrenouf / git_merge_meld.sh
Created September 28, 2011 10:09
Merge helper script for using 'git mergetool' with meld, fixes http://stackoverflow.com/questions/7501666/
#!/bin/bash
# Handles proper use of Meld from Git.
#
# Instead of launching meld with $MERGED as the base revision, this
# script makes a copy of $BASE and handles copying the result back
# to $MERGED if the result was saved.
# As an extra tweak, it also presents branch names (if known) as
# the file name prefix, instead of just "LOCAL" and "REMOTE".