Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file path`
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/
end
@geeknam
geeknam / internet_sharing.scpt
Created March 5, 2011 18:36
Applescript to activate Internet Sharing
register_growl()
growlnote("Copying process", "bootpd.plist copied")
do shell script "sudo cp /tmp/bootpd.plist /etc" password "yourpassword" with administrator privileges
tell application "System Preferences" to set current pane to pane "com.apple.preferences.sharing"
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of row 11 of table 1 of scroll area 1 of group 1 of window "Sharing"
delay 1
if (exists sheet 1 of window "Sharing") then
click button "Start" of sheet 1 of window "Sharing"
end if
@pklaus
pklaus / tunnelbroker-net.sh
Last active September 17, 2024 08:12
tunnelbroker.net automatic tunnel IP update and tunnel setup (on Mac OS X)
#!/bin/bash
#### This script is published by Philipp Klaus <[email protected]>
#### on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-automatic-ip-update-on-mac-os-x/>
#### It is originally by freese60 and modified by limemonkey.
#### Found on <http://www.tunnelbroker.net/forums/index.php?topic=287.0>
### Uncomment this line to debug the script:
#set -x
@lfranchi
lfranchi / vlc-buildsystem-fix-xcode-4.3
Created June 12, 2012 07:18
VLC buildsystem fix for XCode 4.3
diff --git a/contrib/bootstrap b/contrib/bootstrap
index df3dd85..a0a7244 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -143,15 +143,19 @@ add_make_enabled()
check_macosx_sdk()
{
- [ -z "${OSX_VERSION}" ] && echo "OSX_VERSION not specified, assuming 10.5" && OSX_VERSION=10.5
- SDK="/Developer/SDKs/MacOSX${OSX_VERSION}.sdk"
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active April 19, 2025 05:22
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
@bobmoff
bobmoff / UIView+RoundedCorners.h
Created July 10, 2013 15:23
Add rounded corners to any view using layer mask.
#import <UIKit/UIKit.h>
@interface UIView (RoundedCorners)
- (void)setRoundedCorners:(UIRectCorner)corners radius:(CGSize)size;
@end
@hofmannsven
hofmannsven / README.md
Last active April 1, 2025 06:51
Git CLI Cheatsheet
@chitacan
chitacan / 0_make-v8.md
Last active January 7, 2016 12:51
octobersky.js v8 스터디 발표자료

make v8

v8 의 Make 를 분석해 보자.

why we need to hack makefile?

어떤 기술을 응용해 무언가를 만들고자 할 때, 필요한 것 중 하나는 그 기술이 어떻게 구성되어 있는지 확인하는 것. 각각의 구성품들을 살펴보며, 새로운 아이디어를 얻을 수 있다.(레고)

오픈소스의 구성품들은 Makefile에 모두 기술되어 있다.

DB.prototype.getCurrentOpStats = function() {
intervals = [1,5,10,30]
waitingForLock = 0;
secsRunningStats = {};
inProg = db.currentOp()["inprog"]
inProg.forEach(function (op) {
if(op["waitingForLock"]) {
waitingForLock += 1;
}
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions