Skip to content

Instantly share code, notes, and snippets.

@amar-analytx
amar-analytx / spark-ec2.py
Last active August 29, 2015 14:04
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
@alextp
alextp / arow.py
Created January 7, 2012 23:38
arow
# 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
sritchie / plugins.sbt
Created April 20, 2013 00:37
The getting started with ensime post!
// 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 git@github.com:twitter/bijection.git")
resolvers += "Scala-Tools Maven2 Snapshots Repository" at "http://scala-tools.org/repo-snapshots"
@lispnik
lispnik / init.el
Created February 12, 2016 20:06
~/.emacs.d/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" . "https://melpa.org/packages/"))
@davidfraser
davidfraser / uninstall-evernote-cleanup
Created December 29, 2014 09:26
Script to cleanup an Evernote installation under Wine, in order to allow reinstallation - see http://www.sgvulcan.com/evernote-under-wine-already-installed-by-another-user/
#!/bin/bash
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
@jwinder
jwinder / gist:8522372
Created January 20, 2014 15:45
hipchat.el
(require 'mine-jabber)
;; Username & nickname fields from https://banno.hipchat.com/account/xmpp
(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
NicolasT / Conc.lhs
Last active May 25, 2017 03:15
Deriving Typeclass Instances using Typed Holes
# 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mblondel
mblondel / einsum.py
Created May 22, 2015 05:36
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)
print
@jakevdp
jakevdp / VegaMagic.ipynb
Created January 17, 2018 19:04
Simple Vega/Vega-Lite magic function
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.