Skip to content

Instantly share code, notes, and snippets.

View carlosmcevilly's full-sized avatar

Carlos McEvilly carlosmcevilly

View GitHub Profile
@steipete
steipete / PSPDFThreadSafeMutableDictionary.m
Last active December 10, 2022 09:37
Simple implementation of a thread safe mutable dictionary. In most cases, you want NSCache instead, but it can be useful in situations where you want to manually control what is evicted from the cache in low memory situations.**Warning:** I only use this for setting/getting keys. Enumeration is not thread safe here and will still throw exception…
//
// PSPDFThreadSafeMutableDictionary.m
//
// Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@MacLemon
MacLemon / versioning.sh
Created December 9, 2012 23:22
Autoincreasing Build numbers, get version numbers from git tag, put it into Info.plist
#!/bin/bash
# by Andreas Monitzer (@anlumo1) and Pepi Zawodsky (@MacLemon)
#
# This script published under WTF license
# http://en.wikipedia.org/wiki/WTFPL
# Improvements to this script are welcome though.
# Augments the Info.plist with a lot of nice stuff.
# It's suggested to call this script from a "run script" build phase, not copy the script's contents there.
@prashantgosai11
prashantgosai11 / clients.md
Created October 25, 2012 05:53 — forked from defunkt/clients.md
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@jezreljane
jezreljane / 42-things.md
Created October 25, 2012 05:51 — forked from xdite/42-things.md
Ten (42) Things You Didn't Know Rails Could Do
@fanwaze-dev
fanwaze-dev / multiple_ssh_setting.md
Created October 18, 2012 08:53 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@philfreo
philfreo / bucket_policy.js
Created October 6, 2012 01:27
AWS S3 bucket policy to make all files public (+CORS)
{
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket_name_here/*"
#!/usr/bin/env python
"""
Makes JSON files out of CSV files.
"""
import argparse
import csv
import json
parser = argparse.ArgumentParser(description = "Turns a CSV file into JSON")
@jonmountjoy
jonmountjoy / gist_fetch.sh
Created September 25, 2012 14:18
fetch my gists
# first you need to do a one-time setup step to create an OAuth token:
# do this to create an app with your OAUTH token
#
# curl -u github-user-name:github-password -H "Content-Type: application/json" -X POST -d '{"scopes":["gist"], "note": "gist backup"}' \
# https://api.github.com/authorizations
#
# export GIST_OAUTH_TOKEN=xxxxx <<- token retrieved from the curl
#
curl -H "Authorization: token `echo $GIST_OAUTH_TOKEN`" -H "Content-Type: application/json" -X GET https://api.github.com/gists | \
perl -ne 'if (m/.*raw.*(https.*)".*/){ print "$1\n"; }' | \
@jspahrsummers
jspahrsummers / gist:3780283
Created September 25, 2012 13:26
Figuring out the object that a non-string, compiler-verified key path refers to
// doesn't work with __block variables
#define keypath2(PATH) \
do { \
const char *_path = strchr(# PATH, '.') + 1; \
\
id _capturingBlock = ^{ \
return PATH; \
}; \
\
struct _literal { \
@dvcrn
dvcrn / sina.py
Created September 25, 2012 03:05
Bing download url crawler
from pybing import Bing
from urllib2 import HTTPError
from BeautifulSoup import BeautifulSoup
from pybing import constants
import re
import mechanize
import simplejson
searchstring = "cows" # your search string here
searchcount = 40