Skip to content

Instantly share code, notes, and snippets.

@ahpex
ahpex / LinuxCommandlineFu.markdown
Created August 3, 2011 19:18
Linux Commandline-Fu

Linux Commandline-Fu

Date and Time

Convert epoch timestamp to UTC

$ date -u -d @1312398568

Mi 3. Aug 19:09:28 UTC 2011

@ahpex
ahpex / .zshrc
Created August 7, 2011 11:46
.zshrc
# .zshrc
#
# see http://zsh.sourceforge.net/Doc/Release/index-frame.html
# Set FPATH
fpath=(${HOME}/.zsh/completion $fpath)
# Autoloading
autoload -U compinit promptinit colors
colors
@ahpex
ahpex / pdf_demo.rb
Created February 5, 2012 18:22
JRuby IText Example Snippet
require "java"
Dir["/home/michael/Downloads/\*.jar"].each { |jar| require jar }
import com.itextpdf.text.BaseColor
import com.itextpdf.text.Document
import com.itextpdf.text.Paragraph
import com.itextpdf.text.Phrase
import com.itextpdf.text.pdf.PdfPCell
import com.itextpdf.text.pdf.PdfPTable
import java.io.FileOutputStream
[core]
editor = /usr/bin/vim
excludesfile = /Users/np/.gitignore_global
pager=less -x4
[user]
email = name@company.com
name = Firstname Lastname
[fetch]
@ahpex
ahpex / gerrit.py
Last active May 31, 2018 14:30
Retrieve Gerrit changes and pretty-print them on the console
#!/usr/bin/python3
"""
Gerrit response for /changes/ endpoint
[
{
"id": "gerrit~master~Iacd3f2db3728a9c1936170b575016973bf0336d9",
"project": "gerrit",
"branch": "master",
@ahpex
ahpex / fetch_wheel_of_time_character_names.py
Last active November 24, 2020 15:58
Fetch 'Wheel of Time WoT' character names
# Fetch a list of character names for the Wheel of Time (WoT)
# and print them as Dokuwiki links.
from urllib.request import urlopen
from bs4 import BeautifulSoup
def fetch_all_names():
# The WoT page groups some first letters together
first_letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'op', 'r', 's', 't', 'uz']
all_names = [fetch_character_names(x) for x in first_letters]
@ahpex
ahpex / bingwallpaper.py
Created December 18, 2020 08:00
Download Bing Wallpaper with Python
#!/usr/bin/python3
# Simple Script do download the latest wallpaper from Bing
from urllib.request import urlopen
from pathlib import Path
from notify import notification
import json
target_wallpaper_image = Path.home() / 'Images' / 'Wallpaper' / 'bing.jpg'
raw = urlopen('https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US')