Skip to content

Instantly share code, notes, and snippets.

View JonasGroeger's full-sized avatar
🏠
Working from home

Jonas Gröger JonasGroeger

🏠
Working from home
View GitHub Profile
@JonasGroeger
JonasGroeger / manman
Last active April 19, 2016 11:02
Jump to manpage flag
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage (i.e.): manman curl -u"
exit 3
fi
if [ $# -eq 1 ]; then
man "$1"
exit 0
@JonasGroeger
JonasGroeger / remote
Last active April 12, 2016 10:04
Script that allows makes a remote command seem like a local one. Useful for debugging.
#!/bin/bash
# This script executes arbitary commands on a remote server.
# Example: ./remote ls -alf
# If CMD is provided in the configuration section below
# Example (RMT_CMD="ls"): ./remote -alf
# If CMD is defined provided in the environment variables
# Example: RMT_CMD=ls ./remote -alf
@JonasGroeger
JonasGroeger / fix-shortcuts.sh
Created December 16, 2015 21:34
Disables Ubuntu shortcuts that clash with IntelliJ Idea (and probably other Jetbrain products). Creates a backup file to restore the previous settings. To not have some shortcuts disabled, comment them out in the `KEYS` array.
#!/bin/bash
set -euo pipefail
# Disables Ubuntu shortcuts that clash with IntelliJ Idea (and probably other
# Jetbrain products).
#
# Creates a backup file to restore the previous settings. To not have some
# shortcuts disabled, comment them out in the `KEYS` array.
#
# Tested on : Ubuntu 15.10
@JonasGroeger
JonasGroeger / gen-ubuntu-sources-list.py
Created June 16, 2015 09:16
Generates '/etc/apt/sources.list' compatible lists for Ubuntu releases
#!/usr/bin/env python3
import argparse
import getpass
import os
import time
import sys
KNOWN_CODENAMES = ['lucid', 'precise', 'trusty', 'utopic', 'vivid', 'wily']
@JonasGroeger
JonasGroeger / transfer.plugin.zsh
Last active August 29, 2015 14:23
ZSH plugin for transfer.sh (with clipboard function)
#
# Defines transfer alias and provides easy command line file and folder sharing.
#
# Authors:
# Remco Verhoef <[email protected]>
# Jonas Gröger <[email protected]>
#
if (( ! $+commands[curl] )); then
return 1
@JonasGroeger
JonasGroeger / brieffenster
Created February 12, 2015 23:49
Nur das Brieffenster. Kompilieren mit xelatex.
\documentclass%%
%---------------------------------------------------------------------------
[fontsize=12pt,%% Schriftgroesse
%---------------------------------------------------------------------------
% Satzspiegel
paper=a4,%% Papierformat
enlargefirstpage=on,%% Erste Seite anders
pagenumber=headright,%% Seitenzahl oben mittig
%---------------------------------------------------------------------------
% Layout
@JonasGroeger
JonasGroeger / disable-mouse-accel.sh
Last active April 28, 2016 08:04
Script to disable the mouse acceleration on Ubuntu (and probably other distributions).
#!/usr/bin/env bash
################################################################################
# Description #
# Script to disable the mouse acceleration on Ubuntu (and probably other #
# distributions). #
# #
# Author #
# Jonas Gröger <[email protected]> #
# #
@JonasGroeger
JonasGroeger / Clean-Temporary-Files.ps1
Last active August 29, 2015 14:01
Removes temporary LaTeX files. Can be customized to remove arbitrary files by extension or name.
# ------------------------------------------------------------------------------
# Script: Clean-Temporary-Files.ps1
# Author: Jonas Gröger <[email protected]>
# Date: 12.04.2014
# Keywords: LaTeX, Clean, Delete, Remove, Temporary, Files
# Comments: Removes temporary files created by LaTeX etc. You can tweak it by
# adding extensions or specific files.
# ------------------------------------------------------------------------------
Param(
@JonasGroeger
JonasGroeger / jsonify.py
Created April 16, 2014 22:41
A decorator to serialize objects. Apply the decorator to the class.
# coding=utf-8
import json
__author__ = 'Jonas Gröger <[email protected]>'
def jsonify(cls):
def to_json(obj, **kargs):
return json.dumps(obj, default=lambda o: o.__dict__, **kargs)
@JonasGroeger
JonasGroeger / Shutdown.bat
Last active August 29, 2015 13:59
Shows a dialog to shut down the computer in a specified time.
@echo off
setlocal
REM Generic .bat file to launch .ps1 files.
REM Name the .bat file like the .ps1 file and you are done.
set this_file_no_extension=%~n0
set ps1_file=%this_file_no_extension%.ps1