Skip to content

Instantly share code, notes, and snippets.

View 1franck's full-sized avatar

François Lajoie 1franck

  • localhost
View GitHub Profile
@1franck
1franck / profile.ps1
Created February 25, 2023 13:04
powershell profile aliases
Set-Alias ll ls
Set-Alias dc docker-compose
Set-Alias dcu dockerComposeUp
Set-Alias dcd dockerComposeDown
Set-Alias gfp gitFetchPull
function dockerComposeUp {
docker-compose up -d
}
@1franck
1franck / password.rs
Last active July 21, 2022 10:44
simple password gen in rust as learning exercise
fn password_generate(len: i32) -> String {
let mut rng = rand::thread_rng();
let mut password = String::from("");
let lower_chars = String::from("abcdefghijklmopqrstuvwxyz");
let upper_chars = String::from("QWERTYUIOPASDFGHJKLZXCVBNM");
let number_chars = String::from("0987654321");
let symbols_chars = String::from("$!@?%+,().-[];:><\\~#&|/_*");
let mut chars_coll: Vec<char> = lower_chars.chars().collect();
@1franck
1franck / gist:937b54b1f4304115b662c6bb9a63d12c
Created December 21, 2018 03:40
dockerfile for ubuntu / php72 cli stuff
FROM ubuntu:18.04
ENV TZ=America/Toronto
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y software-properties-common && \
apt-get install -y git vim curl whois siege
RUN apt-get install -y php && \
@1franck
1franck / gist:8bcc3f9868d2befa56ebe9b664effac8
Created October 4, 2018 21:50
configure docker container timezone
ENV TZ=America/Toronto
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
@1franck
1franck / gist:b49134a3a4059caeb46ce88d378f1343
Created August 22, 2017 04:55
Delete all files on a large folder in linux
ls -1 | wc -l && time find . -type f -delete
@1franck
1franck / check-gzip-deflate.sh
Created August 21, 2017 05:43
Checking if apache gzip/deflate module is working
# Call the 2 curl commands with your url and compare output results.
# If gzip/deflate is working, the 2 results should be different (second smaller).
# Without encoding header
curl http://example.com --silent --write-out "%{size_download}\n" -L --output /dev/null
# With gzip,deflate encoding header
curl http://example.com --silent -H "Accept-Encoding: gzip,deflate" --write-out "%{size_download}\n" --output /dev/null -L
@1franck
1franck / startvm.bat
Created August 4, 2017 04:10
Start VirtualBox headless vm with a batch file
@echo off
cd /d "C:\Program Files\Oracle\VirtualBox"
VBoxManage.exe startvm "MyVm" --type headless
@1franck
1franck / imageloader.js
Last active January 27, 2017 01:41
Check if an image is loaded after x attempt(s) of x ms each
function ImageLoader(url, callback, attempt_count, attempt_interval) {
var $this = this,
callback = callback,
src = url,
attempt = 0,
attempt_count = attempt_count || 5,
attempt_interval = attempt_interval || 500,
loaded = false,
intervalInstance;
@1franck
1franck / generatePermalink.php
Last active September 15, 2016 20:49
create url safe permalink form text in php