Skip to content

Instantly share code, notes, and snippets.

Iván Montes drslump

Block or report user

Report or block drslump

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@drslump
drslump / cities.csv
Last active Aug 4, 2018
Some sample data for testing jqlite
View cities.csv
LatD LatM LatS NS LonD LonM LonS EW City State
41 5 59 N 80 39 0 W Youngstown OH
42 52 48 N 97 23 23 W Yankton SD
46 35 59 N 120 30 36 W Yakima WA
42 16 12 N 71 48 0 W Worcester MA
43 37 48 N 89 46 11 W Wisconsin Dells WI
36 5 59 N 80 15 0 W Winston-Salem NC
49 52 48 N 97 9 0 W Winnipeg MB
39 11 23 N 78 9 36 W Winchester VA
34 14 24 N 77 55 11 W Wilmington NC
@drslump
drslump / cities.csv
Created Aug 4, 2018
Some sample data for testing jqlite:
View cities.csv
41 5 59 N 80 39 0 W Youngstown OH
42 52 48 N 97 23 23 W Yankton SD
46 35 59 N 120 30 36 W Yakima WA
42 16 12 N 71 48 0 W Worcester MA
43 37 48 N 89 46 11 W Wisconsin Dells WI
36 5 59 N 80 15 0 W Winston-Salem NC
49 52 48 N 97 9 0 W Winnipeg MB
39 11 23 N 78 9 36 W Winchester VA
34 14 24 N 77 55 11 W Wilmington NC
View fsm.py
import sys, types, dis, struct
BINARY_SUBSCR = lambda: Op('BINARY_SUBSCR')
BUILD_TUPLE = lambda x: Op('BUILD_TUPLE', x)
COMPARE_OP = lambda x: Op('COMPARE_OP', x)
INPLACE_ADD = lambda: Op('INPLACE_ADD')
INPLACE_SUBTRACT = lambda: Op('INPLACE_SUBTRACT')
JUMP_ABSOLUTE = lambda x: Op('JUMP_ABSOLUTE', x)
LOAD_CONST = lambda x: Op('LOAD_CONST', x)
LOAD_FAST = lambda x: Op('LOAD_FAST', x)
View pyenv-tmp
#!/usr/bin/env bash
#
# Summary: Creates a temporary virtualenv based on a version
#
# Usage: pyenv COMMAND [version] [tmp-name]
#
# When no version is provided it'll use the currently configured
# one.
#
@drslump
drslump / jqlite
Last active Feb 27, 2019
jqlite: sql queries for tabular data
View jqlite
#!/usr/bin/env bash
#
# Copyright (C) 2018 Iván Montes <drslump@pollinimini.net>.
# This file is licensed under the MIT license.
#
# Requirements:
#
# - Bash 3.x or higher
# - sqlite3
# - gunzip / bzip2 (for compressed input)
@drslump
drslump / csv2json
Last active Mar 21, 2018
json2csv & csv2json
View csv2json
#!/usr/bin/env python
#
# Converts a CSV (with column headers) to JSONL
#
import sys, csv, json
for row in csv.DictReader(sys.stdin):
print(json.dumps(row))
@drslump
drslump / Dockerfile
Created Jun 12, 2017
telepresence docker vpn network
View Dockerfile
FROM ubuntu:xenial
# Install some required base software
RUN apt-get update
RUN apt-get install -y curl sudo iptables
# Install kubectl
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x kubectl
RUN mv ./kubectl /usr/local/bin/kubectl
@drslump
drslump / httpmock.md
Created Apr 30, 2016
idea about an http mock server
View httpmock.md

HTTP Mock

HTTP server to provide configurable mock responses when automating complex scenarios.

Configuring the mocks

Mock logic is not hardcoded into the server, instead it's provisioned just before starting the automated scenario. For that a special endpoint is provided to instruct the server how it should behave.

View djb2.tcl
proc djb2 { {input ""} {result 5381} } {
foreach c [split $input ""] {
set result [expr {($result << 5) + $result + [scan $c %c] & 0xFFFFFFFF}]
}
return $result
}
proc bench1 {} {djb2 "ANOLPMAP447568116268"}
View msisdn-bookmarklet.txt
javascript:(function()%7Bfunction%20r(r%2C%20t)%20%7Bfor%20(var%20n%20%3D%200%2C%20o%20%3D%20r.length%2C%20e%20%3D%205381%3B%20o%20%3E%20n%3B%20n%2B%2B)%20e%20%3D%20((0%20%7C%20e)%20%3C%3C%205)%20%2B%20(0%20%7C%20e)%20%2B%20(0%20%7C%20r.charCodeAt(n))%20%7C%200%3Breturn%20e%20%3D%20(0%20%7C%20e)%20%3E%3E%3E%200%2C%20t%20%3F%20e%20%25%20t%20%3A%20e%7Dfunction%20t(t)%20%7Breturn%20r(%22ANOLPMAP%22%20%2B%20t.trim())%7Dprompt(%22Hashed%20MSISDN%22%2C%20t(prompt(%22Please%20enter%20the%20MSISDN%22)))%7D)()
You can’t perform that action at this time.