Skip to content

Instantly share code, notes, and snippets.

View elmarx's full-sized avatar
🐘
git rebase -i

Elmar Athmer elmarx

🐘
git rebase -i
View GitHub Profile
@elmarx
elmarx / django_gunicorn
Created December 23, 2010 14:35
init.d script for Debian GNU/Linux to run multiple Django instances, each in it's own virtualenv, with gunicorn.
#! /bin/sh
### BEGIN INIT INFO
# Provides: gunicorn_django
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Gunicorn WSGI server for django
# Description: This script starts a gunicorn instance for each django instance
### END INIT INFO
@elmarx
elmarx / new-idea.py
Created January 16, 2011 22:51
Fetches the most recent intellij idea x version if not yet installed, to use in daily anacron job or simliar. Very basic functionality, very specific to my setup. But should be easy to adopt.
#!/usr/bin/env python3
import re
from urllib import request
import os
WEBSITE = "http://confluence.jetbrains.net/display/IDEADEV/IDEA+X+EAP"
MATCH = r".*(http://download\.jetbrains\.com/idea/ideaIU-(\d+\.\d+)\.tar\.gz).*"
with request.urlopen(WEBSITE) as h:
@elmarx
elmarx / cr2stat.py
Created January 18, 2012 16:06
Find cr2 files, that have no corresponding jpg file. Because when I sort pictures, I do it using the jpgs. But I want to delete the original cr2 file, too.
#!/usr/bin/env python
import argparse
import os
from os.path import expanduser
import re
parser = argparse.ArgumentParser(description="Remove raw images without matching jpg (because the jpgs have been removed). Works only for Canon Files. Requires exiftool")
parser.add_argument("directory", metavar="dir", help="scope for image search to work on")
parser.add_argument("-f", "--force", action='store_true', help="delete detected files, instead of just display them")
### Keybase proof
I hereby claim:
* I am zauberpony on github.
* I am elmar (https://keybase.io/elmar) on keybase.
* I have a public key whose fingerprint is AEF0 0A1B BC9C F903 5EB7 BD6D ED51 E88F 8836 FA38
To claim this, I am signing this object:
@elmarx
elmarx / am-i-changed.sh
Created December 12, 2014 09:33
shell-scripts that only executes itself if it changed since the previous run.
#!/bin/sh -
#===============================================================================
#
# FILE: am-i-changed.sh
#
# USAGE: ./am-i-changed.sh
#
# DESCRIPTION: simple snippet to test if the current file has changed, thus needs to be re-run
#
# OPTIONS: ---
location /ip {
default_type 'text/plain';
content_by_lua "ngx.print(ngx.var.remote_addr)";
}
@elmarx
elmarx / 51unattended-upgrades-raspbian
Created January 15, 2022 20:46
unattended-upgrades configuration for raspbian
Unattended-Upgrade::Origins-Pattern {
// Fix missing Rasbian sources.
"origin=Debian,codename=${distro_codename},label=Debian";
"origin=Debian,codename=${distro_codename},label=Debian-Security";
"origin=Raspbian,codename=${distro_codename},label=Raspbian";
"origin=Raspberry Pi Foundation,codename=${distro_codename},label=Raspberry Pi Foundation";
};
@elmarx
elmarx / from_env.rs
Last active March 15, 2024 19:33
access IBM COS with aws-rust-sdk
use aws_sdk_s3::Client;
// sample bucket name of an existing bucket
const BUCKET_NAME: &str = "sweap-ui-test-dev";
/// create a service-key with HMAC enabled,
/// get the content like this: `ibmcloud resource service-key my-key`
///
/// set the environment-variables:
/// AWS_ACCESS_KEY_ID= the cos_hmac_keys.access_key_id