Skip to content

Instantly share code, notes, and snippets.

View EricDupertuis's full-sized avatar
🐕
Down on the corner, Out in the street

Eric Dupertuis EricDupertuis

🐕
Down on the corner, Out in the street
View GitHub Profile
@EricDupertuis
EricDupertuis / keybase.md
Created September 28, 2016 18:15
keybase.md

Keybase proof

I hereby claim:

  • I am EricDupertuis on github.
  • I am thorgilson (https://keybase.io/thorgilson) on keybase.
  • I have a public key whose fingerprint is 1F03 2F5B 8520 A842 7A4F 725D 0022 C3CA 2A7E 30C7

To claim this, I am signing this object:

@EricDupertuis
EricDupertuis / RemoteDb.sh
Created March 30, 2016 13:29
Backup all databases from a remote server.
#! /bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/path/to/dir"
MYSQL_USER="root"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="rootpassorsomething"
MYSQLDUMP=/usr/bin/mysqldump
HOST='server.host'
{
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
"characters": "/",
"selector": "string.quoted.double.html,string.quoted.single.html, source.css"
@EricDupertuis
EricDupertuis / compress.sh
Created January 11, 2016 14:12
Takes png image from original folder and compress theme using zopflipng
#!/bin/bash
for file in original/*.png
do
zopflipng "${file}" compressed/$(basename "${file}")
done
@EricDupertuis
EricDupertuis / monokai.css
Created October 15, 2015 06:53
Monokai Jekyll Highlight
/* highlight */
.highlight pre {background-color: #272822}
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
@EricDupertuis
EricDupertuis / dbBackup.sh
Created August 12, 2015 07:33
Bash script to backup all databases in separate .gzip folder
#! /bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/path/to/backup"
MYSQL_USER="some_user"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="some_user_password"
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p "$BACKUP_DIR/mysql"
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
@EricDupertuis
EricDupertuis / addhttp.php
Last active January 11, 2016 14:11
Add http:// in front of url if it doesn't exist.
<?php
function addhttp($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
$url = "http://" . $url;
}
return $url;
}