Skip to content

Instantly share code, notes, and snippets.

@sblask
sblask / national_geographic_wallpaper_download.sh
Last active December 29, 2015 09:39
Download all wallpapers from national geographic
#!/bin/bash
root=http://ngm.nationalgeographic.com
months=(january february march april may june july august september october november december)
download() {
year=$1
from=$2
to=$3
for month in $(seq $from $to)
@sblask
sblask / .gtkrc-2.0
Created December 28, 2013 01:18
Remove pixel to the right of scroll bar to simplify scrolling using mouse pointer. (Xfce/Gtk)
style "scrollbar"
{
GtkScrollbar::trough-border = 0
}
class "Gtk*Scrollbar" style "scrollbar"
xbacklight -dec 1
xbacklight -inc 1
@sblask
sblask / clone_init
Last active February 22, 2016 00:46
curl --silent https://api.github.com/users/sblask/repos | jq --raw-output ".[] | .ssh_url" | xargs -L 1 git clone
# decrease speed
xinput set-prop "AlpsPS/2 ALPS DualPoint Stick" "Device Accel Profile" 6
xinput set-prop "AlpsPS/2 ALPS DualPoint Stick" "Device Accel Velocity Scaling" 1
xinput set-prop "AlpsPS/2 ALPS DualPoint Stick" "Device Accel Constant Deceleration" 7
xinput set-prop "AlpsPS/2 ALPS DualPoint Stick" "Device Accel Adaptive Deceleration" 60
# set mouse scroll speed
xinput set-prop "AlpsPS/2 ALPS DualPoint Stick" "Evdev Wheel Emulation Inertia" 100
http://redir.xing.com/link/*
https://slack-redir.net/link*
https://*.facebook.com/l.php*
https://deref-gmx.net/mail/client/*
https://outgoing.prod.mozaws.net/*
https://www.google.com/url*
@sblask
sblask / national_geographic_wallpaper_archive_download.sh
Created November 26, 2013 01:01
Download national geographic wallpaper archive
#!/bin/bash
root=http://ngm.nationalgeographic.com/wallpaper/img/
year_number=07
months_letters=(jan feb march april may june july aug sept oct nov dec)
for month in {1..12}
do
month_letters=${months_letters[month - 1]}
for index in {1..20}
import json
import socket
import ssl
ssl_socket = ssl.wrap_socket(socket.socket(), cert_reqs=ssl.CERT_REQUIRED, ca_certs='/etc/ssl/certs/ca-certificates.crt')
ssl_socket.connect(('google.com', 443))
print json.dumps(ssl_socket.getpeercert(), indent=4)
@sblask
sblask / logging_configuration.py
Last active August 31, 2019 14:52
Python logging configuration
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)5s - %(name)s - %(message)s',
filename=os.path.join(os.path.sep, 'path'),
)
def get_log_handler():
log_format = '%(asctime)s - %(levelname)5s - %(name)s - %(message)s'
log_filename = os.path.join(os.path.sep, 'path')
log_formatter = logging.Formatter(log_format)
~/Clones/sandpit $ TF_LOG=TRACE terraform_0_15_0 plan -out plan
2021-04-15T20:18:05.888+1200 [DEBUG] Adding temp file log sink: /var/folders/qy/wfckskrd51l41bfk_ddbx9f40000gn/T/terraform-log369535931
2021-04-15T20:18:05.888+1200 [INFO] Terraform version: 0.15.0
2021-04-15T20:18:05.888+1200 [INFO] Go runtime version: go1.16.2
2021-04-15T20:18:05.888+1200 [INFO] CLI args: []string{"/Users/sebastian/.bin/terraform_0_15_0", "plan", "-out", "plan"}
2021-04-15T20:18:05.889+1200 [TRACE] Stdout is a terminal of width 137
2021-04-15T20:18:05.889+1200 [TRACE] Stderr is a terminal of width 137
2021-04-15T20:18:05.889+1200 [TRACE] Stdin is a terminal
2021-04-15T20:18:05.889+1200 [DEBUG] Attempting to open CLI config file: /Users/sebastian/.terraformrc
2021-04-15T20:18:05.889+1200 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.