Skip to content

Instantly share code, notes, and snippets.

View arnissolle's full-sized avatar
🐌

Pierre Arnissolle arnissolle

🐌
View GitHub Profile

Keybase proof

I hereby claim:

  • I am arnissolle on github.
  • I am arnissolle (https://keybase.io/arnissolle) on keybase.
  • I have a public key ASDglSeqvcjfLUK4gnT12bzAMp-X-Di_4S1hv255JBqkuQo

To claim this, I am signing this object:

<?php
trait Singleton
{
private static $instance;
public static function getInstance(...$args): static
{
if (null === self::$instance) {
self::$instance = new static(...$args);
@arnissolle
arnissolle / cloudflare-ddns-update.sh
Last active September 22, 2021 17:35 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/usr/bin/env sh
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@arnissolle
arnissolle / github_multiple-accounts.md
Created May 13, 2020 10:06 — forked from JoaquimLey/github_multiple-accounts.md
How to Work with GitHub and Multiple Accounts

Step 1 - Create a New SSH Key

We need to generate a unique SSH key for our second GitHub account.

ssh-keygen -t rsa -C "your-email-address"

Be careful that you don't over-write your existing key for your personal account. Instead, when prompted, save the file as id_rsa_COMPANY. In my case, I've saved the file to ~/.ssh/id_rsa_work.

Step 2 - Attach the New Key

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@arnissolle
arnissolle / CSRF.php
Last active October 5, 2019 13:58
CSRF Protection
<?php
class CSRF
{
public static $salt = null;
public static function getToken($force_renew_token = false)
{
if ($force_renew_token || !self::hasValidToken())
{
@arnissolle
arnissolle / mysql.sql
Created April 20, 2019 07:06
Some SQL requests
-- The finest solution for calculating Age from Date of Birth
SELECT TIMESTAMPDIFF(YEAR, birthdate, CURDATE()) AS age FROM users;
@arnissolle
arnissolle / Envoy.blade.php
Last active June 8, 2020 21:11 — forked from gvsrepins/Envoy.blade.php
A Laravel envoy script for deployment
@servers(['production' => 'productionserver', 'local'=> '127.0.0.1'])
{{-- Configuration section --}}
@setup
/*
|--------------------------------------------------------------------------
| Git Config
|--------------------------------------------------------------------------
|
@arnissolle
arnissolle / certbot
Created September 3, 2018 09:04 — forked from wintermeyer/certbot
certbot -q renew --deploy-hook "service nginx reload"
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#!/usr/bin/env bash
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for test domain
# ----------------------