Skip to content

Instantly share code, notes, and snippets.

amar-analytx /
Last active Aug 29, 2015
Spark EC2 with VPC
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# a short implementation of arow in theano
def arow(params, loss, lbda1, lbda2):
sigma = [theano.shared(value=np.ones(p.value.shape)) for p in params]
gl = [T.grad(cost=loss, wrt=p) for p in params]
ups = {}
for i in xrange(len(params)):
ups[params[i]] = params[i] - lbda1*gl[i]/sigma[i]
ups[sigma[i]] = sigma[i] + lbda2*gl[i]*gl[i]
return ups
sritchie / plugins.sbt
Created Apr 20, 2013
The getting started with ensime post!
View plugins.sbt
// Add this file to ~/.sbt/plugins/plugins.sbt.
// Once this is ready, make sure you have sbt 0.12 ("brew install sbt" should do it),
// then try running
// sbt "ensime generate"
// in bijection's root directory. ("git clone")
resolvers += "Scala-Tools Maven2 Snapshots Repository" at ""
lispnik / init.el
Created Feb 12, 2016
View init.el
(if window-system
(tool-bar-mode -1)
(menu-bar-mode -1))
(when (eq window-system 'ns)
(add-to-list 'default-frame-alist '(height . 80))
(add-to-list 'default-frame-alist '(width . 132)))
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . ""))
davidfraser / uninstall-evernote-cleanup
Created Dec 29, 2014
Script to cleanup an Evernote installation under Wine, in order to allow reinstallation - see
View uninstall-evernote-cleanup
echo first uninstall evernote using the wine uninstaller
wine uninstaller
echo now searching forregistry entry to remove
cd ~/.wine/drive_c/windows/profiles/$USER/temp
upgrade_code="`grep 'with upgrade code' EvernoteSetup.log | tail -n 1 | sed 's/^.*with upgrade code {\([A-Fa-f0-9-]*\).*$/\1/'`"
reverse_upgrade_code="`python -c "x='${upgrade_code}' ; y = x[:18].split('-') ; x = x.replace('-', '') ; z = [a+b for a, b in zip(x[16::2], x[17::2])] ; print ''.join(''.join(reversed(part)) for part in y+z).upper()"`"
echo please use regedit to navigate to '\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\UpgradeCodes\' and remove the key "$reverse_upgrade_code"
wine regedit
View gist:8522372
(require 'mine-jabber)
;; Username & nickname fields from
(setq hipchat-username "")
(setq hipchat-nickname "")
(setq hipchat-password "")
(setq hipchat-autojoin-rooms
'("aggregation" "assets" "banno_talk" "banno_cms" "data_services" "emacs" "grip" "kernel" "southen" "troll_talk" "webdev" "design_talk"))
NicolasT / Conc.lhs
Last active May 25, 2017
Deriving Typeclass Instances using Typed Holes
View Conc.lhs
# Deriving Typeclass Instances using Typed Holes
> module Conc where
> import Control.Applicative
We're presented with the following structure:
> data Concurrent a = Concurrent ((a -> Action) -> Action)
> data Action = Atom (IO Action)
> | Fork Action Action
View Examining Your Presence on Twitter with Python.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
mblondel /
Created May 22, 2015
Einstein sum notation
import numpy as np
rng = np.random.RandomState(0)
print "Trace"
A = rng.rand(3, 3)
print np.trace(A)
print np.einsum("ii", A)
jakevdp / VegaMagic.ipynb
Created Jan 17, 2018
Simple Vega/Vega-Lite magic function
View VegaMagic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.