Skip to content

Instantly share code, notes, and snippets.

View miguelcnf's full-sized avatar

Miguel Fonseca miguelcnf

View GitHub Profile
@miguelcnf
miguelcnf / ssh-deploy-key
Created September 23, 2013 00:49
Perl script to iterate through a list of hosts and deploy an ssh public key without having to enter the same user password each and every time.
#!/usr/bin/env perl
#
# Usage: ssh-deploy-key -h (--hostsfile) PATH_TO_HOSTS_FILE
# -p (--pubkeyfile) PATH_TO_PUBKEY_FILE
# [ -u (--user) USER ]
#
# Expects --hostsfile to contain 1 host per line
# Assumes current user if --user is not given
#
@miguelcnf
miguelcnf / main.rs
Last active August 14, 2020 18:01
Raw notes taken during the udemy The Rust Programming Language course by Dmitri Nesteruk
#![allow(dead_code)]
use std::collections::{HashMap, HashSet};
use std::mem;
fn main() {
println!("Hello, world!");
// test_vars();
// test_operators();
// test_constants();
@miguelcnf
miguelcnf / rollback.go
Last active January 29, 2021 20:56
Idiomatic, simple, defer-based rollback mechanism https://play.golang.org/p/p28rpnpiUcL
package main
import (
"errors"
"log"
)
// rollback function
func rollback(rollbackCtrl *bool, rollbackFunc func()) {
if *rollbackCtrl {