Skip to content

Instantly share code, notes, and snippets.

View garno's full-sized avatar
✌️
Hi, I’m Sam!

Samuel Garneau garno

✌️
Hi, I’m Sam!
View GitHub Profile
@garno
garno / open-pr
Last active September 19, 2022 21:18
Small bash script to automatically open Pull Request page with branches correctly selected
#!/bin/sh
# Retrieve branch name
branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
# Retrieve destination branch
destination_branch=${branch%--*}
# Determine the default origin branch
if [[ $branch == $destination_branch ]]; then

Keybase proof

I hereby claim:

  • I am garno on github.
  • I am garno (https://keybase.io/garno) on keybase.
  • I have a public key whose fingerprint is C561 DB35 E1F9 5F34 B4AD A9A0 0C8C 4F5C 5F06 C27A

To claim this, I am signing this object:

@garno
garno / server_load.pl
Created August 24, 2010 02:35
Get the current system load with Perl.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Get current system load average
#
# based on: http://www.skolnick.org/cgi-bin/list.pl?file=serverload.pl
# file: server_load.pl
#
# Get system load average with ruby => %x[perl server_load.pl].to_f
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
print get_load_average();
@garno
garno / Server_load.pl
Created August 24, 2010 00:20
Run script when server load is below threshold written in Perl.
# FOUND ON http://www.skolnick.org/cgi-bin/list.pl?file=serverload.pl
#
#!/usr/bin/perl -w
# serverload.pl
# Subroutine to defer execution if server load is high
# dhs 09/20/02
#
# Subroutine is written to be called from a script run as a cron
# job where specific execution time is much less important than
# not impacting server performance