Skip to content

Instantly share code, notes, and snippets.

View markuman's full-sized avatar
🐧
Linux Only - fail fast, move on

Markus Bergholz markuman

🐧
Linux Only - fail fast, move on
  • Lekker Energie GmbH
  • Berlin
View GitHub Profile
@markuman
markuman / zram.sh
Last active May 13, 2016 07:58
zram
#!/bin/bash
zr=$(lsmod|grep zram)
if [ -z "$zr" ]; then
echo "load zram"
modprobe zram num_devices=5
fi
if (("$#" == 0)); then
echo lz4 > /sys/block/zram0/comp_algorithm &&
echo 4G > /sys/block/zram0/disksize &&
#!/usr/bin/lua
local t = {}
mt = getmetatable ("t")
mt.__index["append"] = function (t,n) t[#t + 1] = n end
setmetatable(t, mt)
for n = 1,9000000 do
alias touchpad-fix='synclient TapButton1=1 TapButton2=3 TapButton3=2 HorizTwoFingerScroll=1 VertScrollDelta=-19 HorizScrollDelta=-19 LeftEdge=0 RightEdge=870 TopEdge=0 BottomEdge=470 MaxSpeed=1.2 AccelFactor=0.1'
@markuman
markuman / remote_exec.sh
Last active July 15, 2017 00:42
parallel ssh with gnu parallel
#!/bin/bash
#this requires a ~/.ssh/config with your hosts
#and a /tmp/hostlist.csv with one hostname (must match to ~/.ssh/config/) per line
# 32 parallel threads
threads=32
function remote_execute () {
echo $1
@markuman
markuman / main.py
Created October 13, 2016 10:36 — forked from miloharper/main.py
A two layer neural network written in Python, which trains itself to solve a variation of the XOR problem. [FORK and EDIT for PYTHON3]
from numpy import exp, array, random, dot
class NeuronLayer():
def __init__(self, number_of_neurons, number_of_inputs_per_neuron):
self.synaptic_weights = 2 * random.random((number_of_inputs_per_neuron, number_of_neurons)) - 1
class NeuralNetwork():
def __init__(self, layer1, layer2):
@markuman
markuman / filter.py
Last active November 15, 2016 20:40
#!/usr/local/bin/python3
import sys, mailbox
MAILDIR = sys.argv[1]
THIS_MAIL = ""
RECEIPT_FOUND = False
SUBJECT_FOUND = False
FILTER = {'[email protected]': 'markus', '[email protected]': 'fuckbook', '[email protected]': 'ebay'}
[alva@canopus ~]$ cat users/m/cur/1479372542.11112.canopus.uberspace.de\:2\,S | ./filter.py users/m/
{'memory_peak': 167336.0, 'PID': 31778}
[alva@canopus ~]$ cat users/m/cur/1479372542.11112.canopus.uberspace.de\:2\,S | ./filter.lua users/m/
13408
[markus@arch ~]$ python2 this.py
/usr/lib/python2.7/site-packages/dejavu/database_sql.py:158: Warning: Table 'songs' already exists
cur.execute(self.CREATE_SONGS_TABLE)
/usr/lib/python2.7/site-packages/dejavu/database_sql.py:159: Warning: Table 'fingerprints' already exists
cur.execute(self.CREATE_FINGERPRINTS_TABLE)
ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
{
"added_at":"2016-10-07T17:42:56Z",
"added_by":{
"external_urls":{
"spotify":"http://open.spotify.com/user/markuman"
},
"href":"https://api.spotify.com/v1/users/markuman",
"id":"markuman",
"type":"user",
"uri":"spotify:user:markuman"
youtube-dl --prefer-ffmpeg --embed-thumbnail --add-metadata --metadata-from-title "%(artist)s - %(title)s" --audio-quality 0 --audio-format mp3 --extract-audio https://www.youtube.com/watch?v=mvK_5nNPKr8