Skip to content

Instantly share code, notes, and snippets.

View nicolanrizzo's full-sized avatar

Nicola Rizzo nicolanrizzo

View GitHub Profile
@nicolanrizzo
nicolanrizzo / angular-reversed-checkboxes-in-reactive-forms.html
Last active December 2, 2020 07:59
Reversed checkboxes in Angular reactive forms
<form [formGroup]="form">
<input
type="checkbox"
[ngModel]="!form.get('myControl').value"
(ngModelChange)="form.get('myControl').patchValue(!$event)"
[ngModelOptions]="{standalone: true}"
>
</form>
@nicolanrizzo
nicolanrizzo / rm_untagged_docker_images.sh
Created February 3, 2017 11:51
Docker: Remove Untagged Images From Docker
docker rmi $(docker images -a | grep "^<none>" | awk '{print $3}')
@nicolanrizzo
nicolanrizzo / nationalitylist_en.html
Last active October 16, 2017 12:56
Nationality list (English, French), dropdown list. Liste nationalités (anglais, français), liste déroulante. https://www.nationalitylist.org https://github.com/nicolanrizzo/nationalitylist
<select>
<option value="AF">Afghan</option>
<option value="AL">Albanian</option>
<option value="DZ">Algerian</option>
<option value="AS">American Samoan</option>
<option value="AD">Andorran</option>
<option value="AO">Angolan</option>
<option value="AI">Anguillan</option>
<option value="AG">Antiguan, Barbudan</option>
<option value="AR">Argentine</option>
@nicolanrizzo
nicolanrizzo / ssh_error_fix.sh
Last active April 17, 2018 09:33
How to Resolve GitHub's, GitLab's, BiBucket's "Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights"
ssh-agent -s
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
@nicolanrizzo
nicolanrizzo / gist:055fcfb2ef3003c2ea6b0135c3608427
Last active December 10, 2016 15:18
Setting up a one-shot webserver on port 8080 to present the content of a file. Source: https://en.wikipedia.org/wiki/Netcat
{ echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c <index.html)\r\n\r\n"; cat index.html; } | nc -l 8080
@nicolanrizzo
nicolanrizzo / default.pp
Created November 20, 2016 17:19
Using puppetlabs-apt module
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/'] }
exec { "install_git":
command => "apt-get install -y git-all",
}
class { 'apt':
update => {
frequency => 'always',
},
@nicolanrizzo
nicolanrizzo / Puppetfile
Created November 20, 2016 17:03
A simple Puppetfile to install the apt module
forge "https://forgeapi.puppetlabs.com"
mod 'puppetlabs-apt'
@nicolanrizzo
nicolanrizzo / librarian-puppet.sh
Created November 20, 2016 16:32
Script to install and to run librarian-puppet
#!/bin/sh
# Check the received options in order to set up some variables
PREFER_PACKAGE=1
while getopts ":g" opt; do
case $opt in
g)
echo "Using the gem installer"
PREFER_PACKAGE=0
;;
@nicolanrizzo
nicolanrizzo / default.pp
Created November 19, 2016 16:23
Install git from Puppet
Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/'] }
exec { "install_git":
command => "apt-get install -y git-all",
require => [ Exec['apt_update'] ],
}
exec { "apt_update":
command => "apt-get update",
}
@nicolanrizzo
nicolanrizzo / git_script.sh
Created November 13, 2016 15:12
Bash script to install git
#!/usr/bin/env bash
apt-get update
apt-get install -y git-all