Skip to content

Instantly share code, notes, and snippets.

View brunogama's full-sized avatar
🏠
Working from home

Bruno Gama brunogama

🏠
Working from home
  • Banco Inter
  • Brazil
  • 00:23 (UTC -03:00)
  • X @brunogama
View GitHub Profile
@brunogama
brunogama / clean_ios_simulator
Created February 9, 2014 13:38
it will clean *ALL* the apps in the iOS Simulator.
#!/usr/bin/env bash
# clean_ios_simulator
# Author: Bruno Gama
pkill -9 -fi simulator 2>/dev/null
_WD="$HOME/Library/Application Support/iPhone Simulator"
find "$_WD" -iname "*.app" | while read l; do
f=$(dirname "$l")
rm -rf "$f"
unset f
@brunogama
brunogama / Delete podcast in overcast.fm
Created October 23, 2014 18:54
because life is too short
$('.episodecell').each(function(index){ window.location = $(this).attr('href').replace('episode', 'delete_item') });
@brunogama
brunogama / gist:479f49f37667c5e1c52d
Created January 30, 2015 16:43
Bulk delete remote git tags
git ls-remote --tags origin | awk '/^(.*)(\s+)(.*[a-z])$/ {print ":" $2}' | xargs git push origin
@brunogama
brunogama / gist:8724d07f0e211a9d0518
Created January 30, 2015 16:45
Bulk delete local git tags
git tag -l | awk '/^(.*[a-z])$/ {print $1}' | xargs git tag -d
@brunogama
brunogama / new-skype
Last active August 29, 2015 14:15
Multiple Skype Instances
#! /usr/bin/env bash
NEXT_SKYPE_PROCESS=$(echo $(( $(ps aux | grep skype | grep -v "grep" | wc -l | tr -d '[[:space:]]') + 1)))
open -na $(mdfind 'kMDItemFSName == "Skype.app"'cd) --args -DataPath /Users/$(whoami)/Library/Application\ Support/Skype${NEXT_SKYPE_PROCESS}
unset NEXT_SKYPE_PROCESS
exit 0
@brunogama
brunogama / gist:1051218
Created June 28, 2011 14:14
Spotlight search by name in the current directory (pwd)
slnamepwd() {
mdfind -onlyin $PWD -name $*
SLNAMETOTAL=$(mdfind -count -onlyin $PWD -name $*)
printf "\nTotal files found ${SLNAMETOTAL}\n"
}
@brunogama
brunogama / NSTimer+Additions.h
Created July 5, 2011 16:45
NSTimer blocks implementation //NOT WORKING.
#import <Foundation/Foundation.h>
typedef void (^VoidBlock)();
@interface NSTimer (NSTimer_Additions)
+ (NSTimer *)scheduleTimerWithTimeInterval:(NSTimeInterval)theSeconds repeats:(BOOL)repeats actions:(VoidBlock)actions;
@end
@brunogama
brunogama / gist:1098261
Created July 21, 2011 21:29
Change the hostname (mac)
sudo scutil --set HostName computer-name.local
@brunogama
brunogama / gist:1251469
Created September 29, 2011 18:10
kill stuff like a boss
# Kill it Like a Boss
function vaporize {
QSTRING=$*
PROC=`ps aux | grep ${QSTRING} | grep -v grep | awk '{print $2}'`
if [ ! -n "$PROC" ]; then
echo "0 PID found with the matching String: \"${QSTRING}\"."
else
NUMPROC=`echo $PROC | awk '{print NF}'`
echo "Found $NUMPROC PIDs with the matching String: \"${QSTRING}\"."
sudo kill -9 $PROC
@brunogama
brunogama / gist:1251473
Created September 29, 2011 18:12
Force Malware Update Definitions (Mac OS Only)
updateMalwareDefinitions() {
sudo /usr/libexec/XProtectUpdater
echo "Last Malware Definitions $(defaults read /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta LastModification)"
}