Skip to content

Instantly share code, notes, and snippets.

Luke Wendling lukewendling

  • Austin TX
View GitHub Profile
lukewendling /
Created Jul 4, 2020
short colorful bash prompt
# Prompt format: username:os:currentdir>
# luke:debian10:myapps>
CURR_DIR=$(basename "$PWD")
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
VERSION=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"')
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:$ID$VERSION:\[\033[01;34m\]${CURR_DIR}\[\033[00m\]> '
lukewendling /
Created Mar 3, 2018
Numba + Numpy benchmark
from numba import jit
from numpy import arange
import numpy as np
def sum2d_loop(arr):
M, N = arr.shape
result = 0.0
for i in range(M):
for j in range(N):
result += arr[i,j]

Create reminders without typing

30 sec. how-to video

Example "Just Ask"

Just ask Luke in 1 hour. Bring a Raspberry Pi.

Just ask Mom tomorrow at 3pm. Reminder for doctor appt.

View screen
to start a session
> screen
(now run some commands)
within screen, to detach (and keep session running)
> ctl a + d
outside of screen, list screen sessions
> screen -ls
View Python parallel v
from multiprocessing import Process
import os
import time
PRIMES_MAX = 10000000
def primes(n):
# info('primes')
if n==2:
return [2]
lukewendling / sample.geo.json
Created Feb 1, 2016
Embed Map - sample geo json
View sample.geo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:0f58454085bb99b6df5f
1.9.3-p545 :001 > (1..2)
=> 1..2
1.9.3-p545 :002 > (1..2).class
=> Range
1.9.3-p545 :003 > (1..2).include?(1)
=> true
1.9.3-p545 :004 > (1..2).include?(3)
=> false
1.9.3-p545 :005 > 1..2.include?(3)
NoMethodError: undefined method `include?' for 2:Fixnum
lukewendling / makeFun.js
Last active Dec 27, 2015
let's assume the original f object was supposed to be an array
View makeFun.js
function makeFun() {
var f = [];
// closure to freeze vars in async loop
var sum = function (n, m) {
return function () {
console.log("sum=" + (n + m));
lukewendling / gist:7030008
Last active Dec 25, 2015
Ruby meta - instance_eval inside a block
View gist:7030008
# Demonstrates a basic module mixin and a slightly advanced meta technique:
# the use_socket (line 13) wrapper method connects to a server and issues
# various SocketIO commands. I use instance_eval (line 16) with a recipient
# SocketIO object, not an instance of the caller (NodeMessenger).
# instance_eval runs the passed block with receiver of self, which is a
# SocketIO object.
# The general purpose of this code is to talk to a server
require 'SocketIO'
module NodeSocket
You can’t perform that action at this time.