Skip to content

Instantly share code, notes, and snippets.

View crsantos's full-sized avatar

Carlos Ricardo Santos crsantos

View GitHub Profile
@crsantos
crsantos / build.sh
Created January 5, 2012 10:06
iOS Build Script
#!/bin/bash
# Bash script to generate a "Release" Build - Based on arrix.blogspot.com code
# - The file must lay on the same .xcodeproj folder
# - Project must be set up with "Debug" (with developer provisioning profiles)
# and "Release" (with distribution provisioning profiles)
# - Project build version will be upgraded with the current datetime and marketing version
# will be the same provided as the second parameter of the script: see USAGE.
#
# USAGE: sh build.sh AppName 0.1.1
@crsantos
crsantos / traktscrobbler
Created March 25, 2012 19:06
init.d daemon for Plex-Trakt scrobbler
#!/bin/bash
USER="CHANGE_NAME"
NAME=traktscrobbler
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/bin/python
SCRIPT=/CHANGE/PATH/TO/Plex-Trakt-Scrobbler/script.py
case "$1" in
start)
echo "Starting $NAME"
@crsantos
crsantos / iosbuildtestflight
Created December 14, 2012 11:10
iOS Build Script With Testflight deployment, exporting .DSYM.zip to ~/Desktop
#!/bin/bash
# Bash script to generate a "Release" Build - Based on arrix.blogspot.com
# - The file must lay on the same .xcodeproj folder
# - Project must be set up with "Debug" (with developer provisioning profiles)
# and "Release" (with distribution provisioning profiles)
# - Project build version will be upgraded with the current datetime and marketing version
# will be the same provided as the second parameter of the script: see USAGE.
#
# USAGE: sh build.sh AppName 0.1.1
//_______________________________________________________________________________________________________________
// this represents the display and behaviour of the cells.
@protocol UITableViewDelegate<NSObject, UIScrollViewDelegate>
@optional
// Display customization
@crsantos
crsantos / 0_reuse_code.js
Created January 15, 2014 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@crsantos
crsantos / rails_resources.md
Created January 15, 2014 14:24 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@crsantos
crsantos / python_resources.md
Created January 15, 2014 14:24 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

#!/usr/bin/env python
import subprocess, sys, threading
PLAY_COMMAND = "mpg123"
class PlayerThread(threading.Thread):
def __init__(self, filename):
self.filename = filename
@crsantos
crsantos / gist:e033887c70fe6c17d81a
Last active September 21, 2015 14:10
APNS deviceToken - NSData* to NSString*
// based on http://stackoverflow.com/a/29075908/468868 answer
const unsigned *tokenBytes = [deviceToken bytes];
NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];

Keybase proof

I hereby claim:

  • I am crsantos on github.
  • I am crsantos (https://keybase.io/crsantos) on keybase.
  • I have a public key whose fingerprint is 4FF1 2840 B9EE CE15 BC0A E54B 8412 AFDD 619A D848

To claim this, I am signing this object: