I hereby claim:
- I am andyroid83 on github.
- I am eknert (https://keybase.io/eknert) on keybase.
- I have a public key ASD2bKew40DQmZYLdJRh27N1C_doLmZF11ZvdUgpvynM_Qo
To claim this, I am signing this object:
#!/usr/bin/env bash | |
# As passing an array by value is not possible (that I know) this function | |
# requires that the array passed has been expanded (@) | |
function in_array() { | |
# Require both needle and haystack | |
if [ -z "$1" -o -z "$2" ]; then | |
return; | |
fi | |
# Use the first argument as needle |
#!/usr/bin/env bash | |
logdir="/var/log/" | |
installed="" | |
# Scan all dpkg logs for installed packages | |
for file in ${logdir}dpkg.log*; do | |
if [ ${file##*.} = "gz" ]; then | |
installed=$installed`gzip -dc $file | grep ' installed' | cut -d' ' -f5` | |
else | |
installed=$installed`cat $file | grep ' installed' | cut -d' ' -f5` | |
fi |
var removeIfPayOnly = function() { | |
var $t = $(this), | |
$free = $t.find('a') | |
.not('[href^=javascript]') | |
.not('[href^=http://www.dagensnyheter.se]'); | |
if (!$free.length) { | |
$(this).remove(); | |
} | |
}; | |
$('.teaser, .subteaser, .half-item').each(removeIfPayOnly); |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env guile | |
!# | |
(use-modules (ice-9 textual-ports) | |
(ice-9 regex)) | |
(let* ((input (get-string-all (current-input-port))) | |
(matches (list-matches "[^<]*<([^>]+)>+" input)) | |
(extractor (lambda (match) (match:substring match 1)))) | |
(display (map extractor matches))) |
#!/usr/bin/env bash | |
# Example of cython --embed producing a .c file for compilation with | |
# all dependencies statically linked. This to create a Python standalone | |
# application. Tested on Ubuntu 16.04. This was done as a learning exercise | |
# only - for real use see https://pyinstaller.readthedocs.io/ | |
OS_ARCH=`echo $(uname -sm) | tr '[:upper:]' '[:lower:]' | tr ' ' '-'` | |
# ..or take from args |
#!/bin/sh | |
# Fail on whitespace errors | |
exec git diff-index --check --cached $against -- | |
exit_code=0 | |
STAGED_GO_FILES=$(git diff --cached --name-only -- '*.go') | |
for file in $STAGED_GO_FILES; do | |
go fmt $file |
import datetime, random | |
ssid = "{}{:02d}{}".format(*[x for x in ['{:%y%m%d}'.format(datetime.datetime(1970, 1, 1) + datetime.timedelta(days=random.randint(-30, 30) * 365 + random.randint(0, 365))), random.randint(0, 99), random.randint(0, 9)]]) | |
print("{}{}".format(ssid, (10 - (sum(map(lambda x: x%10 + int(x/10), map(lambda x,y: x*y, map(int, ssid), [2,1]*4 + [2]))) % 10)) % 10)) |
(function(mod) { | |
if (typeof exports === "object" && typeof module === "object") // CommonJS | |
mod(require("../../lib/codemirror")); | |
else if (typeof define === "function" && define.amd) // AMD | |
define(["../../lib/codemirror"], mod); | |
else // Plain browser env | |
mod(CodeMirror); | |
})(function(CodeMirror) { | |
function wordRegexp(words) { |
import os | |
import glob | |
from pathlib import Path | |
def total_size(dir): | |
"""Scan dir recursively and report total size of all files matching glob pattern""" | |
total_size = 0 | |
last_reported = '' | |
for f in glob.iglob(dir, recursive=True): |