Skip to content

Instantly share code, notes, and snippets.

@ngs
ngs / shell.sh
Created August 28, 2013 19:43
Solution of LeapMotion Python SDK Error: Fatal Python error: PyThreadState_Get: no current thread
install_name_tool -change /Library/Frameworks/Python.framework/Versions/2.7/Python /opt/boxen/homebrew/Cellar/python/2.7.3-boxen2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib /Users/ngs/Documents/LeapDeveloperKit/LeapSDK/lib/LeapPython.so
@bhautikj
bhautikj / vrembed_how_weird.xml
Created February 20, 2016 08:55
vrembed example
<story>
<scene name="intro">
<photo src="https://c2.staticflickr.com/6/5688/23494440049_547ec58c23_k.jpg" isStereo="false" sphereParams="100,66,0,0"/>
<!-- 2015 -->
<photo src="https://c1.staticflickr.com/9/8728/17098966780_4f1ba46dbf_k.jpg" isStereo="false" sphereParams="50,33,90,-25">
<jump jumpTo="2015-a" sphereParams="25,33,90,-45">2015</jump>
<!-- 2013 -->
<photo src="https://c1.staticflickr.com/9/8546/8692786582_6793dab31e_k.jpg" isStereo="false" sphereParams="50,33,90,25">
<jump jumpTo="2013-a" sphereParams="25,33,90,5">2013</jump>
<!-- 2012 -->
@ayman
ayman / keras-example.py
Last active April 24, 2017 13:06
This is an extra annotated, commented illustration example from a Keras tutorial.
# Tutorial from: http://bit.ly/2olREnv
import numpy
from keras.datasets import cifar10
from matplotlib import pyplot
from scipy.misc import toimage
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.constraints import maxnorm
@dwcoates
dwcoates / python-send-code-dwim.el
Last active December 15, 2017 01:01
Convenient function for sending python code to shell
(defvar python-shell-send-code-step-on-function nil
"If non-nil, step sending a function to the python interpreter.")
(defun python-shell-step-after-defun ()
(forward-paragraph)
;; when at last paragraph, don't step to beginning of "next" paragraph
(unless (equal (line-number-at-pos (point))
(progn (forward-paragraph) (line-number-at-pos (point))))
(backward-paragraph)
(forward-line 1)))
@ryanfeeley
ryanfeeley / tesseractops.sh
Created January 22, 2018 17:45
Shell Script for macOS Automator Workflow to OCR Images to Set Finder Comments
for f in "$@"
do
/usr/local/bin/tesseract "$f" stdout | xargs -0 osascript -e 'on run {f, c}' -e 'tell app "Finder" to set comment of (POSIX file f as alias) to c' -e end "$f"
done
@ladyada
ladyada / adafruitlightpaint4pi.py
Created August 10, 2012 00:26
Adafruit Light Painting with Pi
#!/usr/bin/python
# Light painting / POV demo for Raspberry Pi using
# Adafruit Digital Addressable RGB LED flex strip.
# ----> http://adafruit.com/products/306
import RPi.GPIO as GPIO, Image, time
# Configurable values
filename = "hello.png"
@ayman
ayman / TrackRegexRetweeter.py
Created March 8, 2010 23:40
This is a simple Twitter bot which listens to a track stream for a comma delimited list of terms/tags (PRIMARY_TRACK_LIST). From this stream, it will retweet any tweet that matches the secondary regex (SECONDARY_REGEX_FILTER).
#!/usr/bin/env python
# This is a simple Twitter bot which listens to a track stream for a comma delimited
# list of terms/tags (PRIMARY_TRACK_LIST). From this stream, it will retweet any
# tweet that matches the secondary regex (SECONDARY_REGEX_FILTER).
#
# This example is a #Haiti & #Chile Twitter stream listener for TweakTheTweet syntax.
#
# Requires Python 2.6
# Requires Tweepy http://github.com/joshthecoder/tweepy
#
anonymous
anonymous / emacs.memory.leak.aka.distnoted.patch.diff
Created January 22, 2014 03:45
This is a patch (with commentary) that fixes a memory leak in 24.3 for OSX Mavericks (10.9) users who experience excessive resource consumption by distnoted.
From 8ab91751069e391a95151c6716a546b1732ade92 Mon Sep 17 00:00:00 2001
From: JP <twitter:canoeberry>
Date: Sun, 19 Jan 2014 11:58:54 +0000
Subject: [PATCH] partial memleak fix
This patch was created by JP (twitter: @canoeberry) based on a memleak fix by Dirk (emacs committer) below:
https://github.com/mirrors/emacs/commit/57ae6509a3b6a274f89b9caea0284c6156470625
This memory leak is fixed in the trunk as of now and will be in the next official release: 24.4.
/***************************************************************************
* Copyright (C) 2009 by Paul Lutus, Ian Clarke *
* lutusp@arachnoid.com, ian.clarke@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
@tommycarpi
tommycarpi / ipython_notebook+spark.md
Last active September 3, 2021 10:14
Link Apache Spark with IPython Notebook

How to link Apache Spark 1.6.0 with IPython notebook (Mac OS X)

Tested with

Python 2.7, OS X 10.11.3 El Capitan, Apache Spark 1.6.0 & Hadoop 2.6

Download Apache Spark & Build it

Download Apache Spark and build it or download the pre-built version.