Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#----------------------------------------------------------------------------------------#
# Get local ip address for wifi #
#----------------------------------------------------------------------------------------#
ifconfig en0 |grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'
#!/bin/sh
#----------------------------------------------------------------------------------------#
# ipv6 ip address #
#----------------------------------------------------------------------------------------#
curl -s 'http://v6.ipv6-test.com/api/myip.php'

First execute the following commands to install openssl on OSX using Homebrew:

brew update
brew install openssl
brew link --force openssl
openssl version -a

If the new version has not been applied successfully, create a symlink to solve the problem. To do that, we need to figure out the location of openssl using

# Xcode
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
import cStringIO
from boto.s3.connection import S3Connection
from boto.s3.key import Key
def s3upload(filename, extension, file):
conn = S3Connection('AWS_ACCESS_KEY', 'AWS_SECRET_KEY')
k = Key(conn.get_bucket('<bucket name>'))
k.key = filename
k.set_metadata("Content-Type", file.mimetype)

First execute the following commands to install openssl on OSX using Homebrew:

brew update
brew install openssl
brew link --force openssl
openssl version -a

If the new version has not been applied successfully, create a symlink to solve the problem. To do that, we need to figure out the location of openssl using

-(void)dumpAllFonts {
for (NSString *familyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"%@", fontName);
}
}
}

###Optimal Settings for Postgres

log_destination = 'csvlog'

log_directory = 'pg_log'

logging_collector = on (rotates files)

log_filename = 'postgres-%Y-%m-%d_%H%M%S'

##Postgres commands cheatsheet

#####Setup data directory for database

initdb -D /usr/local/pgsql/data

#####Reload Postgres config from command line:

select pg_reload_conf();

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from dateutil import tz
from_zone = tz.tzutc()
to_zone = tz.tzlocal()
#Get a naive datetime