Skip to content

Instantly share code, notes, and snippets.

View yuvadm's full-sized avatar

Yuval Adam yuvadm

View GitHub Profile
@yuvadm
yuvadm / postfix_relay.sh
Created January 21, 2013 15:30
Configuring Postfix to Work With Gmail on Mac OS X
#### Configuring Postfix to Work With Gmail on Mac OS X
#### Based on: http://blog.y3xz.com/blog/2012/01/11/configuring-postfix-to-work-with-gmail-on-mac-os-x/
# add gmail auth details to relay_password file
sudo echo "smtp.gmail.com:587 [email protected]:your_password" >> /etc/postfix/relay_password
# generate lookup db
sudo postmap /etc/postfix/relay_password
# add relay config
@yuvadm
yuvadm / geolocations.json
Created January 14, 2013 19:47
Israel geolocations
This file has been truncated, but you can view the full file.
{
"": {
"status": "ZERO_RESULTS",
"results": []
},
"גילת": {
"status": "OK",
"results": [
{
"geometry": {
@yuvadm
yuvadm / route53DynDNS.bash
Created November 28, 2012 06:50
Amazon Route 53 Dynamic DNS Updater Script
#!/bin/bash
### User Settings (things you must set)
## Location of the dnscurl.pl script
DNSCurl="/path/to/route53DynDNS/dnscurl.pl"
## The host name you wish to update/create
myHostName="*"
## Zone/domain in which host (will) reside(s)
myDomainName="example.com"
@yuvadm
yuvadm / partial_app.py
Created June 8, 2012 18:39
Real-time messaging using Tornado/sock.js/Redis/Brukva
class ConnectionHandler(SockJSConnection):
def __init__(self, *args, **kwargs):
super(ConnectionHandler, self).__init__(*args, **kwargs)
self.client = brukva.Client()
self.client.connect()
self.client.subscribe('some_channel')
def on_open(self, info):
self.client.listen(self.on_chan_message)
@yuvadm
yuvadm / client.ovpn
Created June 7, 2012 19:47
OpenVPN Installation on Ubuntu 12.04
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
@yuvadm
yuvadm / hack.sh
Created March 31, 2012 10:37 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@yuvadm
yuvadm / app.py
Created March 17, 2012 22:22
ep.io Bottle Deployment Template
from bottle import app, route
@route('/')
def index():
return 'Oh Hai!'
application = app()
@yuvadm
yuvadm / gist:1351791
Created November 9, 2011 15:31 — forked from hay/gist:1351230
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@yuvadm
yuvadm / decorators.py
Created October 21, 2011 11:54
Django login_required with 403 on fail
try:
from functools import update_wrapper, wraps
except ImportError:
from django.utils.functional import update_wrapper, wraps # Python 2.4 fallback.
from django.http import HttpResponseForbidden
from django.utils.decorators import available_attrs
def user_passes_test(test_func):
def decorator(view_func):
@yuvadm
yuvadm / transpose.py
Created August 6, 2011 13:26
Transposing a matrix in Python
matrix = [(0,1,2), (0,1,2), (0,1,2)]
transposed = zip(*matrix) # pythonic transpose!
print transposed
# >>> [(0, 0, 0), (1, 1, 1), (2, 2, 2)]