Skip to content

Instantly share code, notes, and snippets.


Benjamin Altpeter baltpeter

View GitHub Profile
baltpeter / keybindings.json
Created Mar 3, 2020
VS Code keyboard shortcuts
View keybindings.json
// Place your key bindings in this file to override the defaultsauto[]
"key": "ctrl+d",
"command": "-editor.action.addSelectionToNextFindMatch",
"when": "editorFocus"
"key": "ctrl+up",
"command": "-scrollLineUp",
baltpeter / config
Created Jul 10, 2015
Proxmox Reverse Proxy with Nginx
View config
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/ssl.crt;
ssl_certificate_key /etc/nginx/ssl/ssl.key;
proxy_redirect off;
location / {
baltpeter / domainchecker.php
Last active May 16, 2018
Reads a list of words and outputs those that are available as both .de and .com to the console
View domainchecker.php
header('Content-type: text/plain');
function checkdomain($domain) {
if($domain == '.com' OR $domain == '.de') return false;
$api_req = file_get_contents('' . $domain);
$api_req = json_decode($api_req, true);
return $api_req['available'] == 'true';
baltpeter /
Created Jan 21, 2017
Create 100 files with random hex-like filenames and random binary content
for n in {1..100}; do
dd if=/dev/urandom of=$( cat /dev/urandom | tr -cd 'a-f0-9' | head -c 6 ) bs=1 count=$(( RANDOM + 1024 ))
baltpeter /
Last active Jul 5, 2016
Setting up locale correctly on new Ubuntu/Debian servers
apt-get update # if this is the first boot on e.g. OpenVZ containers
apt-get install language-pack-en
update-locale LANG=en_US.UTF-8
shutdown -rf 0 # reboot to ensure new locale is applied
# when lang is "(undefinded)"; also preferred anyway
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
baltpeter /
Created Mar 22, 2014
Find out system architecture on Unix
baltpeter /
Created Mar 22, 2014
System Update with apt/aptitude
apt-get update # update repositories first
# then do either
apt-get dist-upgrade
aptitude safe-upgrade # about equiv. to above, safer though
# alternative, doesn't install or uninstall any packages
apt-get upgrade
# reference:
find /path/here -name "what to look for"
baltpeter /
Created Apr 27, 2014
Format and mount new hard drive
#1. Figure out the device name for the new device
fdisk -l
#This will give you output similar to this:
#Disk /dev/sda: 17.2 GB, 17179869184 bytes
#255 heads, 63 sectors/track, 2088 cylinders, total 33554432 sectors
#Units = sectors of 1 * 512 = 512 bytes
#Sector size (logical/physical): 512 bytes / 512 bytes
#I/O size (minimum/optimal): 512 bytes / 512 bytes
baltpeter / UIColor_NSLog
Created May 3, 2014
Use NSLog to output a UIColor
View UIColor_NSLog
CGFloat red, green, blue, alpha;
[color getRed: &red
green: &green
blue: &blue
alpha: &alpha];
NSLog(@"red = %f. Green = %f. Blue = %f. Alpha = %f",
You can’t perform that action at this time.