Skip to content

Instantly share code, notes, and snippets.

@vkryukov
vkryukov / gist:4d53f84080bf088f087b
Created June 30, 2014 20:27
go.enmime library example
package main
import (
"bytes"
"fmt"
"log"
"net/mail"
enmime "github.com/jhillyerd/go.enmime"
)
@schnoddelbotz
schnoddelbotz / call-x.pl
Last active August 29, 2015 14:08
Place a call from terminal using your iPhone - by providing contact's (partial) name (works for local/OnMyMac Contacts.app/AddressBook records only)
#!/usr/bin/perl
# call-x
# no beauty but some joy:
# use osx address book from terminal for (i)phone dialing purposes.
#
# usage:
# $ call-x your-pal's-name...or-partial-number...
#
# In response to the wonderful link max shared with me:
@Jupiterrr
Jupiterrr / sync.sh
Last active August 29, 2015 14:11
This script syncs the current directory to /home/docker/share on a boot2docker vm.
#!/bin/bash
set -u # prevent unbound variables
set -e # terminate on error
SSH_PORT=$(boot2docker config 2>&1 | awk '/SSHPort/ {print $3}')
# install rsync
boot2docker ssh tce-load -wi rsync
@eduardocereto
eduardocereto / get_top_domain.js
Created July 3, 2012 21:18
Always return top level domain
/**
* First domain where cookies can be set by the browser.
*/
function get_top_domain(){
var i,h,
weird_cookie='__top_level=cookie',
hostname = document.location.hostname.split('.');
for(i=hostname.length-1; i>=0; i--) {
h = hostname.slice(i).join('.');
document.cookie = weird_cookie + ';domain=.' + h + ';';
@lucacioria
lucacioria / domains_api_tutorial.markdown
Last active December 21, 2015 10:29
Google+ Domains API with Service Accounts (Quick Start Tutorial in Python on App Engine)

Google+ Domains API - Quick Start

introduction

Google+ Domains API are meant to interact with your G+ accounts in the domain. With these APIs you can manage circles, read and write posts, shares, and comments etc.. more informations here

This tutorial is for creating an application that uses the Domains API, running on Google App Engine with python.

create GAE (Google App Engine) app

class BankAccount < ActiveRecord::Base
# Umsätze von start_date bis end_date abrufen
# * passport_type, passphrase, pin und file kommen in dieser Implementation aus der zugrunde liegenden Tabelle.
# * Wenn passport_type = "PinTan" ist, wird die pin verwendet.
# * Wenn passport_type = "RDHNew" ist, wird die Schlüsseldatei aus filename verwendet und mit der passphrase entschlüsselt.
def get_transactions(start_date, end_date)
HBCIUtils.setParam("client.passport.#{passport_type}.filename", filename)
HBCIUtils.setParam("client.passport.#{passport_type}.init", '1')
@sailor
sailor / Vagrantfile
Created March 25, 2015 13:09
Vagrantfile for Rails development environment
VAGRANTFILE_API_VERSION = '2'
$install = <<SCRIPT
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
SCRIPT
$build = <<SCRIPT
cd /vagrant
fig build
@jimeh
jimeh / sudome.rb
Created November 20, 2009 23:30
sudome — A simple Ruby method which checks if the current script is running as root, and if not, re-invokes itself by using the sudo command.
# A simple Ruby method which checks if the current script
# is running as root, and if not, re-invokes itself by
# using the sudo command.
def sudome
if ENV["USER"] != "root"
exec("sudo #{ENV['_']} #{ARGV.join(' ')}")
end
end
@chiedo
chiedo / boot2docker-nfs-osx.md
Last active October 4, 2019 20:32
Configuring boot2docker to use NFS on an OSX machine

Configuring Boot2Docker to use NFS on an OSX based machine

  • To improve the speed of Boot2Docker drastically, you will want to set it up to use NFS.
  • You will need to do the following once on your host machine:
    • Add this to /etc/exports on your mac

      # BOOT2-DOCKER-BEGIN
      /Users 192.168.59.103 -alldirs -mapall=501:20
      # BOOT2-DOCKER-END
      
@compwright
compwright / build-mamp-osx.sh
Created November 29, 2012 17:55
Roll your own MAMP development environment
# This file is a reference script for the blog post
# http://jonathonhill.net/2012-11-29/roll-your-own-mamp-development-environment/,
# and is not intended to be run as a stand-alone install script.
# Some manual steps will be required, please read the blog post before attempting
# to use this script.
# Tutorial:
# http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/
# Download and install XQuartz from http://xquartz.macosforge.org/