Skip to content

Instantly share code, notes, and snippets.

View bsima's full-sized avatar
drinking coffee

Ben Sima bsima

drinking coffee
View GitHub Profile
//Setting the position of the Glastonbury map marker.
var markerPositionGlastonbury = new google.maps.LatLng(51.159803, -2.585585);
//Setting the icon to be used with the Glastonbury map marker.
var markerIconGlastonbury = {
url: 'icons/icon_glas_uk.png',
//The size image file.
size: new google.maps.Size(225, 120),
//The point on the image to measure the anchor from. 0, 0 is the top left.
origin: new google.maps.Point(0, 0),

Regarding this /r/clojure thread

How would such a generator work? First, relevant quotes on the bootstrapping process, from the boot wiki

The bootstrapping process can be expressed in terms of input and output:

FuserBOOTSTRAPJcp + Fcp + Fasset + E

; paste in .emacs.d/init.el
(defun connect-remote (user ip)
"Opens an SSH tunnel to remote host with full emacs functionality."
(interactive "sUser: \nsIP: ")
(dired (format "/%s@%s:/" user ip)))
; save machines with init.el functions something like this:
(global-set-key (kbd "C-c 1") (connect-remote "user" "192.168.1.1"))
@bsima
bsima / db.clj
Created February 19, 2015 04:29
for yesql, generate queries from all directory of files
(defn make-queries-from-dirs
"Takes a variable number of directory paths (which are presumably in the classpath)
as arguments. For each path, finds the .sql files and calls `defquery` on each,
turning the filename (without the extension) into the query name. Does not walk
subdirectories for more .sql files."
([src & rest] (map #(make-queries %) (cons src rest)))
([src] (let [dir (clojure.java.io/file src)
files (filter #(.isFile %) (file-seq dir))
names (map #(.getName %) files)
sqls (filter #(re-matches #".*\.sql$" %) names)
# linux
xclip -sel clip < ~/.ssh/id_rsa.pub
# mac
cat ~/.ssh/id_rsa.pub | pbcopy
# Replace bsima with your own handle, obviously
# Requires pup https://github.com/EricChiang/pup
curl -s https://github.com/bsima | pup '#contributions-calendar > div:nth-child(5) > span.contrib-number text{}'

Ben: do you have docs on converting C structs to Python in your mindmap?
I'm looking for refs, tutorials
or books

Chad: interpreting structs as Python objects is basically my entire Halo project
what is it you're trying to do, at a slightly higher level?
anyway my first recommendation would be ctypes
it's kind of a pain, but ultimately using 100% pure Python is a blessing
Cython can be nice but it can be overkill, and the build env might be hard to replicate (at least on windows)

import serial
import binascii
import struct
d = []
file = open('capture.txt', 'r')
xrandr --output eDP1 --mode 3200x1800 --output HDMI1 --auto --left-of eDP1