Skip to content

Instantly share code, notes, and snippets.

@svenk
svenk / demo.sh
Created May 28, 2013 08:56
Das Bash-1x1 für den theoretischen Physiker, der C(pp) mit GCC programmiert
# Begrifflichkeiten: Shell = Kommandozeile Linux, Bash = Verbreitestes Shell-Programm
Angenommen du hast ein C++-File namens "hello.cc"
#include <stdio.h>
int main() {
printf("Hallo Welt\n");
return 0;
}
@svenk
svenk / website-notify.sh
Created July 22, 2013 08:48
A website change checker / detection changer / script to keep track of changes of any website (URL). Intended to be run on a 24/7 running server like a login server in your university institute.
#!/bin/bash
#
# Notify when website changes-script:
# This is a simple mini program that informs you whenever a website
# changes. Can perform any job when triggered.
# Usage:
# ./notify "jobname fuer mail" "http://abc.def/interessant.html"
# The script will run "in foregrund". You can e.g. use GNU screen to detach it
# and run it in the background on a 24h-running-server:
# $ screen
@svenk
svenk / generate_blankpdf.sh
Last active March 25, 2021 20:48
Insert blank (white) pages between each page in a PDF file from shell
#!/bin/bash
base64 -d <<BASE | gunzip > blank.pdf
H4sICAEz+lIAA2JsYW5rLnBkZgCNVE1P20AQpa16WXEk970goCXsh712XCGkxB8RIgiU5ECbcjDO
AqHBRs66Cr32RvsTKvXSX1CpVZF6Kn+g6qWnnntHcO9snJCUILWW7PW+ed55b2bk+W0vKLIVE81f
fLj4evH54j3imOJk7witrpKajA/UITYAqZOg01UyJUE3VNKTUdKWa2uop1IZHqP+O+O70Vz8/ahJ
t+nMx1px8/rt3HJt9np57qx+/u3T3OWX+wVUuNr99Xqz8ONN4co9q809vyzcP58JH87+RDJuD0+C
N50cGUMVlnEDmWNhzdMTSXa29o5kpBBpZHtKA0GSHiNSqST9Fi462OQUW9TU6wrDu4hU0yQ7ga8b
pJmGce8kTGUcnRK3QTz5shPJerVCNrBKM+1sZL6E7nCOJq0/mIHr3h0exFiwW8Z0RSCMMYnCwSuc
MOLZN7xJtDT+OkhihTWrjkaudRFS8KZBrdbvq2pDgUAI+NWGwGIU2U6TqCFVi0CrSVP2FVk/Dg+k
@svenk
svenk / PyPunchcards
Last active January 24, 2016 18:07
Proposal for Punchcard modeling in Python
This gist was an experiment to explore ways to model punch cards with Python nicely.
Focus was spent on good reability/introspection and fault tolerance (incomplete
punch cards/tristates) and not on performance.
@svenk
svenk / 3FarbenLED.cpp
Last active November 2, 2016 18:40
3Farben LED Arduino für Heribert
/**
* Kommentierte Fassung fuer ein Arduino-Testprogramm
**/
// Anschlussbelegung:
#define PIN_ROT 2
#define PIN_GRUEN 3
#define PIN_BLAU 4
// Taste (Button) an Pin 7 anschließen!
@svenk
svenk / Makefile
Created December 15, 2016 22:16
Some Fortran/C linking test
CC=gcc
F90=gfortran
all:
${CC} -Wall -c main.c
${F90} -c aux.f90
${CC} -o test main.o aux.o -lgfortran
clean:
rm *.o test
@svenk
svenk / extract.c
Created February 6, 2017 20:55
Convert a GIMP exported Header file back to a PNM Image which can be viewed with any program
#include "The-GIMP-exported-file.h"
#include <stdio.h>
/* This code converts a GIMP C export back to a readable PNM Image. Such
header file looks like
static const struct {
unsigned int width;
unsigned int height;
unsigned int bytes_per_pixel; // 2:RGB16, 3:RGB, 4:RGBA
@svenk
svenk / yaml-reader.php
Created November 3, 2017 17:53
Multi document YAML reader for PHP
<?php
/*
* There is currently no pure PHP yaml parser capable of reading
* multi documents (--- separated). I have tested both spyc and Symfony's YAML.
*
* Therefore I parse YAML with Python, encode it to json and read the json in
* PHP. The json is cached on disk.
*
* Public Domain by http://github.com/svenk
*/
@svenk
svenk / ViewSourceWith.ps1
Created November 17, 2017 11:59
A Firefox Quantum ViewSourceWith extension workaround with Firefox's source.editor.external
# A Firefox Quantum ViewSourceWith replacement for Windows
#
# Usage:
# (1) Save as C:\path\to\script.ps1
# (2) In order to run your own powershell scripts, start PowerShell
# as Administrator and run the command
#
# Set-ExecutionPolicy RemoteSigned
#
# (2) You can test the proper running (from a user cmd):
@svenk
svenk / resolver.c
Created November 21, 2017 12:26
ViewSourceWith.cpp
/**
* A Firefox Quantum ViewSourceWith replacement for Windows.
* When compiled, this behaves like an editor, i.e. you call
* it with a file as an argument. It tries to extract then
* the real file to open.
*
* Todo:
*
* 1) Read editor path from INI file with GetPrivateProfileString
* 2) hide the console when opening the real notepad