This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Using SSH, create a SOCKS4/5 proxy connection to a remote server and configure the system to use it. | |
_pgrep() { | |
P_CMD=$1 | |
P_PID=$( ps -u $USER -o pid,command | grep "${P_CMD}" | grep -v grep | head -1 | awk '{ print $1 }' ) | |
echo "$P_PID" | |
if [ -z $P_PID ]; then return 1; else return 0; fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MANFILE=$( man -w $1 $2 ) | |
NAME=$( basename $MANFILE ) | |
if [ -r $MANFILE ]; then | |
groff -mandoc $MANFILE -t | pstopdf -i -o "$NAME.pdf" | |
echo "wrote $NAME.pdf" | |
else | |
echo $MANFILE #Error message, probably. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILE="$1" | |
VCODEC=$( mediainfo --Inform="Video;%Format%" "$FILE" ) | |
ACODEC=$( mediainfo --Inform="Audio;%Format%" "$FILE" ) | |
echo $FILE: $VCODEC/$ACODEC | |
[ "$VCODEC" = "AVC" ] && VC="copy" || VC="libx264" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import datetime | |
import os | |
import json | |
import requests | |
from bs4 import BeautifulSoup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define UICOLOR_FROM_HEX(x) [UIColor colorWithRed:(((NSUInteger)(x & 0xff0000) >> 16)/255.) \ | |
green:(((NSUInteger)(x & 0x00ff00) >> 8)/255.) \ | |
blue:(((NSUInteger)(x & 0x0000ff))/255.) \ | |
alpha:1.0] | |
UIColor *color = UICOLOR_FROM_HEX(0xff00ff); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
def encode(n): | |
result = "" | |
while (n > 0): | |
n,m = divmod(n,len(ALPHABET)) | |
result = ALPHABET[m] + result | |
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Strip Alias | |
# Released into the public domain without restriction. | |
# | |
# Takes an existing post-Lion obese alias and creates a simple alias. | |
SRC="$1" | |
DST="$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <objc/objc.h> | |
#import <objc/objc-class.h> | |
#import <malloc/malloc.h> | |
#pragma mark Keyed Object | |
@interface KeyedObject : NSObject | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function make_icon { | |
sips -s format png -Z $3 "$1" --out "$2" | |
pngcrush -ow -q "$2" | |
} | |
echo "Using $1 as the base image." | |
echo "** App Store: iTunesArtwork **" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(id)forwardingTargetForSelector:(SEL)aSelector | |
{ | |
// Do we have a scroll view delegate? | |
if (_scrollViewDelegate && [_scrollViewDelegate conformsToProtocol:@protocol(UIScrollViewDelegate)]) { | |
// Is this a selector in that protocol? | |
struct objc_method_description methodDescription = protocol_getMethodDescription(@protocol(UIScrollViewDelegate), aSelector, NO, YES); | |
if (methodDescription.name != NULL) return _scrollViewDelegate; | |
} | |
return [super forwardingTargetForSelector:aSelector]; | |
} |
OlderNewer