Skip to content

Instantly share code, notes, and snippets.

View tmaximini's full-sized avatar

Thomas Maximini tmaximini

View GitHub Profile
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters
@tmaximini
tmaximini / snippets.bash
Last active May 17, 2019 07:03
[ssh fu] ssh snippets
# copy files from shh to local
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
# and upload from local to ssh
scp -r /path/from/destination username@hostname:/path/to/destination
@tmaximini
tmaximini / cleanupJenkinsWorkspaces.groovy
Created May 7, 2019 07:35 — forked from EvilBeaver/cleanupJenkinsWorkspaces.groovy
A jenkins script to clean up workspaces on slaves
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
@tmaximini
tmaximini / docker snippets
Last active May 27, 2019 12:33
Docker commands #docker
# remove dangling (untagged) images (with -f force)
docker rmi -f $(docker images -f "dangling=true" -q)
docker rm $(docker ps -q -f status=exited) # Cleanup exited processes:
docker volume rm $(docker volume ls -qf dangling=true) # Cleanup dangling volumes
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) # Cleanup dangling images
# start jenkins with port mapping and passing in docker.sock
sudo docker run -u root --rm -d -p 80:8080 -p 5000:5000 -v jenkins-data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
### Keybase proof
I hereby claim:
* I am tmaximini on github.
* I am tmaximini (https://keybase.io/tmaximini) on keybase.
* I have a public key whose fingerprint is 8DA4 8630 49F6 00C5 DEAD 1B9E B3C4 9339 9AAF 02D5
To claim this, I am signing this object:
@tmaximini
tmaximini / 00.howto_install_phantomjs.md
Created November 16, 2015 18:21 — forked from julionc/00.howto_install_phantomjs.md
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@tmaximini
tmaximini / SassMeister-input.scss
Created April 1, 2015 20:10
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
.my-class {
font-size: 14px;
color: black;
&__bodytext {
font-size: 12px;
@tmaximini
tmaximini / Contract Killer 3.md
Last active August 29, 2015 14:14 — forked from malarkey/Contract Killer 3.md
basic open source design / software / consulting contract blueprint

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@tmaximini
tmaximini / SassMeister-input.scss
Created November 4, 2014 20:20
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
.spaVoucher .spaVoucher {
font-size: 14px;
color: black;
&__bodytext {
font-size: 12px;