Skip to content

Instantly share code, notes, and snippets.

View awidegreen's full-sized avatar

Armin Widegreen awidegreen

View GitHub Profile
@awidegreen
awidegreen / bash_template.sh
Created April 22, 2012 13:41
bash template
#!/bin/bash
scriptname="script_template"
### functions
function usage
{
echo -e "usage: $scriptname MANDATORY [OPTION]\n"
echo -e "MANDATORY mandatory parameter:"
echo -e " -m, --mandatory VAL The desc of the mandatory parameter\n"
@awidegreen
awidegreen / vim_cheatsheet.md
Last active April 12, 2024 02:26
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@awidegreen
awidegreen / vimrc
Created February 24, 2013 22:47
vim header file hook to include template
fun! CppHeaderFileHook()
let l:filename = tolower(expand("%"))
let l:filename = substitute(l:filename, ".hh$","_HH_", "")
let l:filename = toupper(l:filename)
source ~/templates/cpp_header.template
execute "silent %s/FILENAME_HH_/".l:filename."/g"
endfun
autocmd BufNewFile *.hh call CppHeaderFileHook()
@awidegreen
awidegreen / csh_complete_wrapper.rb
Last active December 16, 2015 09:58
A parameter completion wrapper for (t)csh. It can be called from the built-in csh complete command
#!/usr/bin/env ruby
#
# This is a wrapper to query the appropiate command/parameter
# completions for (t)csh.
#
# Armin Widegreen (c) 2013
#
# A call returns a space-seperated string
# of the possible completions, e.g.:
# ParameterCompletion.getCompletionString("cmd1 diff")
@awidegreen
awidegreen / arm_boards.md
Last active December 19, 2015 05:19
List of (full) equipped ARM boards: just to keep an overview
@awidegreen
awidegreen / poweronlinux.md
Created July 14, 2013 21:50
Some hints on how to save some power on linux, in my case arch on a samsung series 7 ultra
@awidegreen
awidegreen / pulseaudio.service
Last active January 20, 2024 15:10
systemd definition for pulseaudio in system-mode (example for archlinux). The pulseaudio developers explicitly recommend to NOT run pulseaudo system-mode!
# systemd service spec for pulseaudio running in system mode -- not recommended though!
# on arch, put it under /etc/systemd/system/pulseaudio.service
# start with: systemctl start pulseaudio.service
# enable on boot: systemctl enable pulseaudio.service
[Unit]
Description=Pulseaudio sound server
After=avahi-daemon.service network.target
[Service]
ExecStart=/usr/bin/pulseaudio --system --disallow-exit --disallow-module-loading
@awidegreen
awidegreen / promiscuous@.service
Created July 16, 2013 13:21
systemd service for promiscuous mode. On archlinux, store it under /etc/systemd/system/promiscuous@.service enable it with: systemctl enable promiscuous@enp1s0.service Difference between file from archwiki: add "After" and changed path from "/usr/sbin/ip" to "/usr/bin/ip" since every executable is now located there
[Unit]
Description=Set %i interface in promiscuous mode
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set dev %i promisc on
RemainAfterExit=yes
[Install]
@awidegreen
awidegreen / rts5139.conf
Created September 30, 2013 06:14
blackling rts5139 sd card reader until kernel 3.11 release, under /etc/modprobe.d/
# disable card reader until it is fixed with 3.11
blacklist rts5139
@awidegreen
awidegreen / fuzzyclock_german.sh
Created October 29, 2013 20:27
a german fuzzyclock in shell
#!/bin/bash
###################################################################################
# Copyright (c) 2009 Armin Widegreen <armin.widegreen@gmail.com> #
# #
# This program is free software; you can redistribute it and/or modify it under #
# the terms of the GNU General Public License as published by the Free Software #
# Foundation, either version 3 of the License, or (at your option) any later #
# version. #
# #