Skip to content

Instantly share code, notes, and snippets.

@balupton
balupton / LINUX.md
Last active May 27, 2022 10:22
New Machine Start Kit

Linux

Setup

# If inside vmware install vmware tools (these are just as good as the commercial ones)
sudo apt-get install open-vm-tools open-vm-tools-desktop

# Install git
sudo apt-get install git
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 5, 2023 21:58
A real world usage for git subtrees.

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add git@github.com:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@capnslipp
capnslipp / where_am_i.rb
Created October 18, 2012 22:42
where_am_i: tiny Ruby debugging extension to sum up the current location in the object graph
## encoding: utf-8
## author: Slipp Douglas Thompson <http://slippyd.com/>
class Object
  # notice: it's a verbal statement
  def where_i_am
    object_index = self.object_id
    class_name = self.class.name
    
    class_lineage = begin
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 29, 2024 14:52
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@simX
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
@btipling
btipling / unfucktenxer.js
Created June 14, 2012 06:13
Remove tenxer github hooks. They will not delete the hooks they add to your private repos even if you tell them to remove your github info. I had to remove 173 hooks added by tenxer.
#!/usr/local/bin/node
var https = require('https');
var token, username;
var tenxer = 'tenxer';
var shitsFucked = 0;
var shitsUnfucked = 0;
var reposCount = 0;
process.argv.forEach(function (arg) {
@capnslipp
capnslipp / git-lf
Last active June 28, 2023 19:37
Lost & Found for Git: tag all dangling commits, for those wonderful “oh shit” moments (and cleanup those tags after recovered the lost path)
#!/usr/bin/env bash
# Tags all dangling commits in a Git repo (for the wonderful “oh shit” moments).
# @from: https://gist.github.com/capnslipp/2656868
git fsck --lost-found #--no-reflogs --full --root --cache --tags --unreachable
find '.git/lost-found/commit' -type f | while read i; do
commit_sha=`cat "$i"`
git tag -f "git-lf/commit/$commit_sha" $commit_sha
done
anonymous
anonymous / gist:2523336
Created April 29, 2012 02:01
Changing author info
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@capnslipp
capnslipp / group-permissify.sh
Created April 5, 2012 17:28
*nix Group Permissionify (if it works for me, it should work for my buddies too)
#!/usr/bin/env bash
shared_group="$1" # e.g.: 'admin'
group_exists=`grep "^$shared_group:" /etc/group`
if [ -z $group_exists ]; then
echo "Error: There seems to be no group by the name of \"$shared_group\" (totally checked out your '/etc/group' file)."
else
echo "Permissifying within ./ directory..."
## encoding: utf-8
## Alex D's solution (1st revision) to http://stackoverflow.com/questions/5390537/best-practices-and-implementation-for-macro-and-class-level-accessor-methods/9019388#9019388
module MacroMethods
private
def full_name(full_name)
# non-trivial, one-time-only set-up code exists here in actual usage
self.class_eval { const_set :FULL_NAME, full_name.to_s }