Skip to content

Instantly share code, notes, and snippets.

@noamtm
noamtm / links.md
Last active August 29, 2015 14:15
Helpful articles and links
@noamtm
noamtm / build-dist.sh
Created February 1, 2015 15:18
iOS: Re-sign an app for distribution
# This is not a ready-to-run script. It just shows the relevant command-line calls.
XC_WORKSPACE=path/to/MyApp.xcworkspace
XC_SCHEME=MyApp
XC_CONFIG=Release
ARCHIVE_PATH=dest/path/to/MyApp.xcarchive
EXPORT_PATH=dest/path/to/MyApp.ipa
DIST_PROFILE=NameOfDistributionProfile
# Build and archive. This can be done by regular developers, using their developer key/profile.
@noamtm
noamtm / parse_ipa.py
Last active August 18, 2022 14:23
Python: Parse Info.plist from IPA on OSX
#!/usr/bin/env python
from Foundation import NSData, NSPropertyListSerialization
import fnmatch
import sys
from zipfile import ZipFile
# TODO: Add error checking.
def parse_plist(info_plist_string):
@noamtm
noamtm / qr.html
Created January 19, 2015 10:36
HTML/JS QR Generator. See inside.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
Usage: put text as the query string.
http://path/to/qr.html?text-to-encode
Based on https://github.com/davidshimjs/qrcodejs (and embeds it).
-->
<head>
<title>Cross-Browser QRCode generator for Javascript</title>
@noamtm
noamtm / dropboxshare.py
Created December 22, 2014 09:20
Dropbox upload and share. Quick and dirty, no auth (assumes existing access token). Only tested with an app that can only access its own files, in which case the target folder is relative to the app root folder.
#!/usr/bin/env python
# usage:
# ./dropboxshare.py TARGET_FOLDER FILES ...
# Upload all files to the same folder.
# Inside the folder, files are given the same name as their origin.
# Prints a list of URLs, one on each line.
import dropbox
from sys import argv
@noamtm
noamtm / echoplus.js
Created August 31, 2014 13:07
node.js echo server
/*
Node.js echo server
Starts an http server on port 8000. The server responds with:
- request headers as json
- 3 newline characters ('\n\n\n')
- request body (piped)
It does not attempt to "understand" the request in any way.
I use it for debugging clients, mostly POSTs.
@noamtm
noamtm / attrdict.py
Last active May 29, 2018 20:26
Python: read-only access to dictionary keys as attributes
# There are other solutions across the interwebs. This is one that avoids complexities
# because it's read-only (useful when you just want to read json data, for example).
# It also makes it possible to read nested dictionaries in the same way.
# Based on ideas from http://code.activestate.com/recipes/473786-dictionary-with-attribute-style-access/
class attrdict (dict):
'''
Read-only access to dictionary keys as attributes.
>>> d=attrdict({"a":1, "b":2, "c":{"a":1, "b":2, "c":{"a":1, "b":2}}})
>>> d.a
@noamtm
noamtm / OrderedYAML.py
Created November 7, 2012 10:53 — forked from enaeseth/yaml_ordered_dict.py
Load YAML mappings as ordered dictionaries
import yaml
import yaml.constructor
def load(data):
try:
# included in standard lib from Python 2.7
from collections import OrderedDict
except ImportError:
# try importing the backported drop-in replacement