Skip to content

Instantly share code, notes, and snippets.

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

rkt orklann

🏠
Working from home
View GitHub Profile
@harshkn
harshkn / CircBuffer.c
Created April 8, 2011 09:26
C Implementation of simple circular buffer, Functionality provided are add to queue, read latest
typedef struct circular_buffer
{
void *buffer; // data buffer
void *buffer_end; // end of data buffer
size_t capacity; // maximum number of items in the buffer
size_t count; // number of items in the buffer
size_t sz; // size of each item in the buffer
void *head; // pointer to head
void *tail; // pointer to tail
} circular_buffer;
@andyfowler
andyfowler / .vimrc
Created September 5, 2011 18:08
Swap iTerm2 cursors in vim insert mode when using tmux
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
@jeffkreeftmeijer
jeffkreeftmeijer / XmlParser.h
Created March 15, 2012 11:24
Objective-C XML parser
#import <Foundation/Foundation.h>
@interface XmlParser : NSObject <NSXMLParserDelegate>
@property (strong, nonatomic) NSData *xmlData;
@property (strong, nonatomic) NSMutableDictionary *dictionary;
@property (strong, nonatomic) NSMutableDictionary *currentNode;
@property (strong, nonatomic) NSMutableDictionary *currentParentNode;
- (id)initWithXMLData:(NSData *)xmlData;
@ishworgurung
ishworgurung / kevent_srv.py
Created May 24, 2012 07:15
So, how can I use kqueue/kevent on BSD/Mac using Python?
#!/usr/bin/env python
"""
Example on using Kqueue/Kevent on BSD/Mac
using Python.
The TCP server essentially echoes back the
message it receives on the client socket.
"""
__author__ = "Ishwor Gurung <ishwor@develworx.com>"
@jordelver
jordelver / gist:3073101
Created July 8, 2012 22:06
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

@cook
cook / draw-arrow-with-pattern.mm
Last active December 13, 2015 19:59
在Quartz 2D中使用pattern。
void drawStripes(void *info, CGContextRef con)
{
// assume 4x4 cell
CGContextSetFillColorWithColor(con, [[UIColor redColor] CGColor]);
CGContextFillRect(con, CGRectMake(0, 2, 4, 2));
CGContextSetFillColorWithColor(con, [[UIColor blueColor] CGColor]);
CGContextFillRect(con, CGRectMake(0, 0, 4, 2));
}
@dustinsenos
dustinsenos / gist:5294392
Created April 2, 2013 17:42
Retina Mouse Cursor Files. Below is the file location of the retina mouse cursors on OS X 10.8.3. All files are .pdfs (thanks Apple) so they should work perfectly in Photoshop, Illustrator etc.
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HiServices.framework/Versions/A/Resources/cursors
@interface NSImage (GIF)
- (BOOL)isGifImage;
- (BOOL)saveAnimatedGIFToFile:(NSString*)filepath;
@end
@implementation NSImage (GIF)
- (BOOL)isGifImage
{
@FiloSottile
FiloSottile / 32.asm
Last active March 23, 2024 12:28
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@JamieMason
JamieMason / unfollow.js.md
Last active April 26, 2024 19:31
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//