Skip to content

Instantly share code, notes, and snippets.

View mathieu-aubin's full-sized avatar
💭
blop!

Mathieu Aubin mathieu-aubin

💭
blop!
  • Montreal, Quebec, Canada
View GitHub Profile
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
fi
export PERLBREW="command perlbrew"
_perlbrew_compgen() {
COMPREPLY=( $($PERLBREW compgen $COMP_CWORD ${COMP_WORDS[*]}) )
}
complete -F _perlbrew_compgen perlbrew
@mathieu-aubin
mathieu-aubin / c7repos.sh
Last active June 28, 2018 03:27
Centos 7 basic repository installation (C7Repos)
#!/bin/bash
bash <(curl -4sLk https://bit.ly/c7repos)
# Deprecated -- use the gitHUB repository instead
@mathieu-aubin
mathieu-aubin / lowsrc.js
Created June 11, 2017 03:46 — forked from takien/lowsrc.js
Alternate to lowsrc. usage: <img src="lowres.jpg" data-src="highres.jpg" />
/**
* Laod large image at last.
* requires jQuery
* @author: takien
*/
jQuery(document).ready(function($){
$('img').each(function(){
var hires = $(this).data().src;
if((hires != undefined) && (hires != '')){
$(this).attr('src',hires);
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.53
Comment: https://keybase.io/crypto
yMIiAnicrVJdSBVBGL1qaVqC9hIFPbQlWZnu3JnZ3bE/CiKt6KGikszbzM7sdVHv
ve3de/NiRZQPZlSCEIJZERmRQnL7UbN/EhQpkSKIipLSwuiHAkMobVfqIeixeRnm
+845c77D9yA9yZOW0DhxrTs1+m15Qt+9+ohne3XqeJXEgjwm5VdJZWLyEuVchG1f
mcmlfEkGMlARRRDLiOuGDhSsAuTVEWIEKFDWBFJkJmMd6l5GDcKhxhEXEFOIsFdD
AEAmUylHMsyAX1ghywzYrixTqWwYSCMGYxBDjQrBvCpFqsvlWNEVwjQCHGJpMOwy
HHOMhkWuGXRqzsM3ae8f+P/sOzIpRyEUHBGFYaoywJiXaFyFmBEGBCGAuMCwsAK0
@mathieu-aubin
mathieu-aubin / redir.sh
Created November 13, 2016 18:43 — forked from digitalresistor/redir.sh
Simple script that prints a list of redirects, and what the final HTTP result was...
function count_redir {
curl -L -I -D - -o /dev/null $1 | awk 'BEGIN { redir = 0; status = 200; } tolower($1) ~ /http/ { redir=redir+1; status=$2 } tolower($1) ~ /location:/ { print redir, status, $2 } END { print "Completed, with ", redir-1, "redirects. Final result: ", status }'
}
#!/bin/bash
# To run as a script, leave as is. Save to file and chmod +x, then execute in the dir where zipfiles are.
# To use as a function, remove line 1, uncomment line 4 and 12 and call using unzip-all in the dir where zipfiles are.
#unzip-all() {
local dir='.';
[[ ! -z "${1// }" ]] && dir=$1;
for z in *.zip; do
q=$(echo $z | cut -f 1 -d '.');
unzip $z -d $dir/$q;
@mathieu-aubin
mathieu-aubin / free-ram.sh
Last active August 22, 2016 04:10
Bash Typewritter-style demo script. Also serves a purpose, freeing up some ram on low-level servers.
#!/usr/bin/env bash
#
# free-ram.sh
#
# Copyright 2016 Mathieu Aubin <mathieu@zeroserieux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@mathieu-aubin
mathieu-aubin / camelcode.pl
Created July 29, 2016 00:39
Perl crazy camel -- impressive
#!/usr/bin/perl -w
use strict;
$_='ev
al("seek\040D
ATA,0, 0;");foreach(1..2)
{<DATA>;}my @camel1hump;my$camel;
my$Camel ;while( <DATA>){$_=sprintf("%-6
9s",$_);my@dromedary 1=split(//);if(defined($
_=<DATA>)){@camel1hum p=split(//);}while(@dromeda
ry1){my$camel1hump=0 ;my$CAMEL=3;if(defined($_=shif
@mathieu-aubin
mathieu-aubin / 256-colors.sh
Last active July 22, 2016 19:24
The following script display the 256 colors available on some terminals and terminals emulators like XTerm and GNOME Terminal.
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
@mathieu-aubin
mathieu-aubin / colors_and_formatting.sh
Created June 13, 2016 22:05
The following shell script displays a lot of possible combination of the attributes (but not all, because it uses only one formatting attribute at a time).
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#Background
for clbg in {40..47} {100..107} 49 ; do