Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Nilsson danijeel

View GitHub Profile
@danijeel
danijeel / aws_retry.sh
Last active Mar 23, 2018
#bash #aws #retry awscli retry backoff for bash
View aws_retry.sh
#!/usr/bin/env bash
set -e
aws_retry() {
last_aws_call=""
local max_attempts=${ATTEMPTS-8}
local timeout=${TIMEOUT-2}
local attempt=0
local exitCode=0
@danijeel
danijeel / index.sh
Last active Aug 9, 2018
#bash #boilerplate
View index.sh
#!/bin/bash
# https://explainshell.com/explain?cmd=set+-euxo%20pipefail
set -eou pipefail
yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 111; }
try() { echo "$ $@" 1>&2; "$@" || die "cannot $*"; }
# log to syslog and echo output
info() {
@danijeel
danijeel / shutdown.js
Last active Feb 2, 2018
#windows Windows 10 shutdown prompt (Alt+F4)
View shutdown.js
(new ActiveXObject("Shell.Application")).ShutdownWindows();
View keybase.md

Keybase proof

I hereby claim:

  • I am danijeel on github.
  • I am danijeel (https://keybase.io/danijeel) on keybase.
  • I have a public key whose fingerprint is F928 2329 DBF9 5448 27B9 9D6F F23E 000A 2F0D 0C55

To claim this, I am signing this object:

@danijeel
danijeel / cdRomEject_every_10_second.vbs
Created Dec 16, 2013
Annoying Windows script to eject cdrom every 10 second
View cdRomEject_every_10_second.vbs
set oWMP = CreateObject("WMPlayer.OCX.7")
set colCDROMs = oWMP.cdromCollection
wscript.sleep 10
do
if colCDROMs.Count >= 1 then
for i = 0 to colCDROMs.Count -1
colCDROMs.Item(i).Eject
Next
For i = 0 to colCDROMs.Count -1
colCDROMs.Item(i).Eject
You can’t perform that action at this time.