Skip to content

Instantly share code, notes, and snippets.

View dhhdev's full-sized avatar

Daniel Hyldebrandt Hemmingsen dhhdev

View GitHub Profile
@dhhdev
dhhdev / my-arch-install-cheat-sheet.md
Last active July 15, 2024 16:50
My Arch Installation Cheat Sheet, so I can remember it all.

Install Arch Linux

This is my personal setup almost every time I install Arch Linux. This is meant for me as being something I can quickly reference.

Change localkeys to my keyboard layout

In my case I have a Danish keyboard layout.

@dhhdev
dhhdev / sinkswitcher.sh
Last active November 28, 2015 01:25
Automaticly switch currently running sink-inputs to your default (selected fall-back) output device.
#!/bin/bash
# Dependencies: pulseaudio
# Optional: pavucontrol
# Automaticly switch currently running sink-inputs to your default sink.
# $ pactl set-default-sink
# Pavucontrol can be used to do this with a GUI.
# Special thanks goes to Steve Parker for helping me with refining the script.
@dhhdev
dhhdev / git-create.sh
Created March 13, 2016 02:55
Create a repository on remote server and start hacking!
#!/bin/bash
## Start repository on own Git Server and start hacking.
## Yes, it could be way better - detection of already made repository, etc.
## Usage: git-create.sh <reponame> "<description>"
## Never use slashes!
# Connection
HOST='git'
USER='git'
@dhhdev
dhhdev / live
Last active March 29, 2016 22:30
I wanted a simple way to repeat a command purely in Bash: /usr/local/bin/live
#!/bin/bash
# A simple script to "watch" a command in pure Bash.
help() {
echo "live is a simple bash script, that keeps looping a specified command, just like the well known watch command. But made in Bash."
echo
echo " Usage:"
echo " live [arguments...] command"
echo
echo " Arguments:"
@dhhdev
dhhdev / compile.sh
Last active April 23, 2016 00:00
A script to quickly compile a file using gcc.
#!/bin/bash
# Save the file in /usr/local/bin/ and call it whatever you like.
# I simply call mine: compile
# Now I can compile a .c file with compile test.c command.
if [ -z "${1}" ]; then
echo "We can't take over the world, without compiling a file!"
else
if [ -z "${2}" ]; then
@dhhdev
dhhdev / tmux.sh
Created June 19, 2016 02:30
Create a named session to tmux with three panes, or attach if already present
#!/bin/bash
#
# ~/.tools/tmux.sh
#
# Author: Daniel H. Hemmingsen <[email protected]>
# Usage: tmux.sh session-name /path/to/start/from"
#
# Could make a simple check, with groups or something.
# To see if the students should get write access or not.
@dhhdev
dhhdev / tmux-teacher.sh
Last active March 2, 2021 12:21
Only allow students to access sessions in progress with the read only flag, teachers can create tmux sessions as they wish.
#!/bin/bash
#
# ~/.tools/tmux-teacher.sh
#
# Author: Daniel H. Hemmingsen <[email protected]>
# Usage: tmux-teacher.sh session-name /path/to/start/from"
#
TEACHER_GROUP="teacher"
@dhhdev
dhhdev / gcc.zsh
Last active July 1, 2016 06:21
A very simple set of .zsh (oh-my-zsh) custom stuff. Can be loaded in your ~/.oh-my-zsh/custom/ directory.
#
# ~/.oh-my-zsh/custom/gcc.zsh
#
# gcc wrapper for compiling ansi
# Usage: compile_ansi [output][files]
compile_ansi()
{
OUTPUT=$1
shift
@dhhdev
dhhdev / christmas.sh
Last active October 17, 2016 19:36
BSD date version of how many days until Christmas :-)
#!/bin/sh
# Today, as day-of-year (1-366)
TODAY=$(date -j +"%j")
# Christmas day, in d-B-y format converted to days
CHRISTMAS=$(date -jf "%d-%B-%y" "25-DEC-16" +"%j")
echo "There are $(($CHRISTMAS - $TODAY)) days until Christmas."

Keybase proof

I hereby claim:

  • I am dhhdev on github.
  • I am dhh (https://keybase.io/dhh) on keybase.
  • I have a public key whose fingerprint is C989 405D 350B 3DCB 1598 B202 9434 9D73 2CDB C9D6

To claim this, I am signing this object: