Skip to content

Instantly share code, notes, and snippets.

View dlnilsson's full-sized avatar

Daniel Nilsson dlnilsson

  • Sweden
  • 11:16 (UTC +02:00)
View GitHub Profile
@dlnilsson
dlnilsson / chrome_version.bash
Last active March 29, 2022 12:06
Print current chrome version on Linux
#!/usr/bin/env bash
candidates=(
"chromium"
"google-chrome"
"google-chrome-stable"
"chromium-browser"
)
(for c in "${candidates[@]}"; do
@dlnilsson
dlnilsson / aws_retry.sh
Last active January 25, 2021 11:30
#bash #aws #retry awscli retry backoff for bash
#!/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
@dlnilsson
dlnilsson / index.sh
Last active August 9, 2018 07:07
#bash #boilerplate
#!/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() {
@dlnilsson
dlnilsson / shutdown.js
Last active February 2, 2018 08:20
#windows Windows 10 shutdown prompt (Alt+F4)
(new ActiveXObject("Shell.Application")).ShutdownWindows();

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:

@dlnilsson
dlnilsson / cdRomEject_every_10_second.vbs
Created December 16, 2013 18:33
Annoying Windows script to eject cdrom every 10 second
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