Skip to content

Instantly share code, notes, and snippets.

View darkmavis1980's full-sized avatar
🎯
Focusing

Alessio Michelini darkmavis1980

🎯
Focusing
View GitHub Profile
@darkmavis1980
darkmavis1980 / regex.js
Last active January 14, 2019 15:35
List of Regular Expressions
// email validation
^([a-zA-Z0-9.+_-]+)@([a-z0-9.-]+)\.([a-zA-Z]{2,6}$)
// phone numbers
([0-9+\s]+)$
// price, eg: 30, 12.45
^([0-9]+)(\.[0-9]+)?$
@darkmavis1980
darkmavis1980 / certbot
Last active September 25, 2021 11:14
Renew Certbot certificate
# renew with dry run
certbot renew --dry-run
# get challenge
certbot -d domain.com --manual --preferred-challenges dns certonly
# install certificate
certbot --nginx -d domain.com
@darkmavis1980
darkmavis1980 / listdir.py
Created September 20, 2018 15:13
Simple python test script to retrieve the files of the current directory
import os
files = os.listdir(os.curdir)
for file in files:
print(f'- {file}')
@darkmavis1980
darkmavis1980 / listdir.py
Last active September 20, 2018 15:34
Simple python test script to retrieve the files of the current directory
import os
path = os.curdir
files = os.listdir(path)
for file in files:
if os.path.isfile(path + file):
filesize = os.path.getsize(path + file)
print(f'- {file} - {filesize} Bytes')
else:
@darkmavis1980
darkmavis1980 / input.html
Last active August 16, 2018 15:32
Placeholder move on focus
<h1>The floating label</h1>
<div class="input-wrapper">
<input type="text" name="email" required/>
<label>Your email address</label>
</div>
@darkmavis1980
darkmavis1980 / input.html
Created August 16, 2018 14:49
Placeholder move on focus
<!--
# found here https://stackoverflow.com/questions/35942247/how-to-move-placeholder-to-top-on-focus-and-while-typing
-->
<h1>The floating label</h1>
<div class="user-input-wrp">
<br/>
<input type="text" class="inputText" required/>
<span class="floating-label">Your email address</span>
</div>
@darkmavis1980
darkmavis1980 / launch.json
Last active July 13, 2018 08:35
Xdebug with VS Code & Vagrant
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": true,
"pathMappings": {
@darkmavis1980
darkmavis1980 / force-git-push
Last active July 5, 2018 15:51
Force git push
// When somebody fucked up the repo big time and the pre-hook fails without giving you an error, run this
git push --force --no-verify origin master
// or shorter
git push -f --no-verify origin master
@darkmavis1980
darkmavis1980 / composer-starter.php
Created June 7, 2018 12:36
Load packages with namespaces installed with Composer
<?php
require 'vendor/autoload.php';
use Namespace\For\Your\Package\Classname;
$a = new Classname();
$b = $a->someMethod();
?>
@darkmavis1980
darkmavis1980 / electron-install
Created May 30, 2018 10:59
Install electron globally
sudo npm install electron -g --verbose --unsafe-perm=true