Skip to content

Instantly share code, notes, and snippets.

Norcoen /
Created November 21, 2022 13:22 — forked from nuxeh/
Automated NixOS installer script
# For installing NixOS having booted from the minimal USB image.
# To run:
# sh -c "$(curl"
#!/usr/bin/env bash
# Installs NixOS on a Hetzner server, wiping the server.
# This is for a specific server configuration; adjust where needed.
# Prerequisites:
# * Update the script wherever FIXME is present
# Usage:
Norcoen /
Created September 15, 2021 02:02 — forked from AnthonyDiGirolamo/
Raspberry Pi Provisioning Script
#!/usr/bin/env bash
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp -r archives pi@ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh pi@ 'sudo mv ~/archives/* /var/cache/apt/archives/'
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_setup pi@ ; ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh pi@ 'bash ~/pi_setup pi9 109'
# for pi in 110 111 112
# do
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_keys pi@192.168.3.$pi:~/.ssh/authorized_keys
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp pi_hosts pi_mpihostsfile pi@192.168.3.$pi:~/
# ~/apps/sshpass/bin/sshpass -p 'raspberry' scp ~/.ssh/config pi@192.168.3.$pi:~/.ssh/
# ~/apps/sshpass/bin/sshpass -p 'raspberry' ssh pi@192.168.3.$pi 'cat /etc/hosts pi_hosts | tee hosts ; sudo cp hosts /etc/hosts'
Norcoen /
Created March 19, 2021 00:31 — forked from pmeinhardt/
download an entire page (including css, js, images) for offline-reading, archiving… using wget

If you ever need to download an entire website, perhaps for off-line viewing, wget can do the job — for example:

$ wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains --no-parent

This command downloads the website

The options are:

  • --recursive: download the entire website
  • --domains don't follow links outside
Norcoen / Arch Linux, Fedora
Created February 14, 2021 22:39 — forked from elvetemedve/Arch Linux, Fedora
Allow Vagrant usage without providing sudo password
View Arch Linux, Fedora
sudo tee /etc/sudoers.d/vagrant > /dev/null << EOL
# Arch Linux, Fedora sudoers entries
# Allow passwordless startup of Vagrant with vagrant-hostsupdater.
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
Cmnd_Alias VAGRANT_HOSTS_REMOVE = /usr/bin/sed -i -e /*/ d /etc/hosts
Norcoen /
Created January 29, 2021 00:17 — forked from grenade/
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/mozilla_rsa
Norcoen / gitlab-webhook-push.php
Created November 12, 2020 16:40 — forked from pitchart/gitlab-webhook-push.php
A simple php script to manage gitlab push webhook
View gitlab-webhook-push.php
* GitLab Web Hook
* See
* This script should be placed within the web root of your desired deploy
* location. The GitLab repository should then be configured to call it for the
* "Push events" trigger via the Web Hooks settings page.
* Each time this script is called, it executes a hook shell script and logs all

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

Norcoen / SoapClientCurl.php
Created March 19, 2019 12:12 — forked from stefanvangastel/SoapClientCurl.php
PHP 5.3 SoapClient with cURL request
View SoapClientCurl.php
* Class SoapClientCurl extends SoapClient __doRequest method with curl powered method
class SoapClientCurl extends SoapClient{
//Required variables
public $url = null;
public $certfile = null;
public $keyfile = null;
public $passphrase = null;
Norcoen / realurl_conf.php
Created January 28, 2019 14:44 — forked from lorenzulrich/realurl_conf.php
TYPO3 RealURL: Two sites in an installation, both with one domain per language
View realurl_conf.php
$realUrlSiteConfigurations = [
'site1' => [
'rootPageUid' => 1,
'schema' => 'https',
'languageDomainMap' => [
0 => '',
1 => '',
2 => '',