Skip to content

Instantly share code, notes, and snippets.

@jrosco
jrosco / self-signed-certificate-with-custom-ca.md
Created September 4, 2020 00:26 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@jrosco
jrosco / expbackoff.sh
Created August 18, 2020 00:37 — forked from nathforge/expbackoff.sh
Exponential backoff in Bash
expbackoff() {
# Exponential backoff: retries a command upon failure, scaling up the delay between retries.
# Example: "expbackoff my_command --with --some --args --maybe"
local MAX_RETRIES=${EXPBACKOFF_MAX_RETRIES:-8} # Max number of retries
local BASE=${EXPBACKOFF_BASE:-1} # Base value for backoff calculation
local MAX=${EXPBACKOFF_MAX:-300} # Max value for backoff calculation
local FAILURES=0
while ! "$@"; do
FAILURES=$(( $FAILURES + 1 ))
if (( $FAILURES > $MAX_RETRIES )); then

Keybase proof

I hereby claim:

  • I am jrosco on github.
  • I am j12d (https://keybase.io/j12d) on keybase.
  • I have a public key ASA8G1QSXh1NZEKQDsFHDzZcYcQE4Po2RkzabaWyUJXUXwo

To claim this, I am signing this object:

@jrosco
jrosco / check_md5sum_dpkg,sh
Created September 12, 2018 06:49
Check a installed packages mdsum on files
$ dpkg -S /usr/sbin/tcpd
tcpd: /usr/sbin/tcpd
$ (cd /; md5sum -c /var/lib/dpkg/info/tcpd.md5sums)
usr/sbin/safe_finger: OK
usr/sbin/tcpd: OK
usr/sbin/tcpdchk: OK
usr/sbin/tcpdmatch: OK
usr/sbin/try-from: OK
usr/share/man/man8/safe_finger.8.gz: OK
usr/share/man/man8/tcpd.8.gz: OK
@jrosco
jrosco / gist:f0ef92d4e1dba79f185d05acd18ed925
Created July 25, 2017 08:56 — forked from dc2447/gist:3335099
akamai - Test if an asset is cached TCP_HIT or uncached TCP_MISS
curl -s -I -H "Pragma: akamai-x-cache-on" http://images.apple.com/ipad/images/product_title.png | grep X-Cache:
@jrosco
jrosco / Bash_Default_Args.sh
Created June 7, 2017 20:59
Bash use default cmd args
#!/bin/bash
set -e
ARG_ONE=${1:-ONE}
ARG_TWO=${2:-TWO}
ARG_THREE=${3:-THREE}
echo "1:${ARG_ONE} - 2:${ARG_TWO} - 3:${ARG_THREE}"
@jrosco
jrosco / rotate_desktop.sh
Created May 24, 2016 15:24 — forked from mildmojo/rotate_desktop.sh
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@jrosco
jrosco / yoga-auto-rotate
Created May 22, 2016 09:26 — forked from emiller/yoga-auto-rotate
Lenovo Yoga 13 tablet mode / auto rotation script (ubuntu/debian)
#!/bin/bash
#
# yoga-auto-rotate -- ghetto-style tablet mode, with keyboard and all.
#
# Simple little script that will detect an orientation change for a
# Lenovo Yoga 13 (very hackily) and adjust the active display's
# orientation and disable/enable the touchpad as necessary.
#
# The Yoga 13 will emit keycode `e03e` at one second intervals
# when the screen is flipped into tablet mode. Since this keycode
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
@jrosco
jrosco / progress_bar.rb
Created March 24, 2016 04:39 — forked from kuntoaji/progress_bar.rb
Simple progress bar script without Gem using Ruby.
#!/usr/bin/env ruby
progress = 'Progress ['
1000.times do |i|
# i is number from 0-999
j = i + 1
# add 1 percent every 10 times
if j % 10 == 0