Skip to content

Instantly share code, notes, and snippets.

View madeindjs's full-sized avatar
💩

Alexandre Rousseau madeindjs

💩
View GitHub Profile
@madeindjs
madeindjs / LeLogDuRoumain.php
Created January 31, 2017 15:59
a short logger to quickly include in your file
<?php
class LeLogDuRoumain{
private $f;
function __construct($f='~/Desktop/le_log_du_roumain.txt'){$this->f=$f;}
function log($data){file_put_contents($this->f,date('h:i:s').' '.$data.PHP_EOL,FILE_APPEND);}
}
@madeindjs
madeindjs / .bashrc
Created March 10, 2017 13:24
My custom bashrc properties
# Change PS1 display
function parse_git_branch()
{
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# arousseau ~/www (feature/5651) $
PS1="\[\e[1;32m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\]\[\033[31m\]\$(parse_git_branch)\[\033[00m\] \$ "
# ~/www (feature/5651) $
PS1="\[\e[1;34m\]\w\[\e[m\]\[\033[31m\]\$(parse_git_branch)\[\033[00m\] \$ "
@madeindjs
madeindjs / bckp_server.sh
Last active November 23, 2018 13:46
Create a dated backup for my server
#!/bin/bash
# colors
green='\e[0;32m'
darkred='\e[1;31m'
lightblue='\e[1;34m'
defaut='\033[0m'
# importants variables
today=$(date +%Y-%m-%d)
@madeindjs
madeindjs / .ssh\config
Created May 4, 2017 12:00
Configuration file for SHH
Host pi
Hostname 168.192.1.1
Port 12345
User pi
IdentityFile ~/.ssh/raspberry.id_rsa
@madeindjs
madeindjs / style.css
Last active May 10, 2017 09:04 — forked from alxlion/style.css
Fix dark input Firefox
input:not(.urlbar-input):not(.textbox-input):not(.form-control):not([type='checkbox'])
:not(#search_form_input):not(#search_form_input_clear):not(#search_button):not(#search_form_input_homepage) {
-moz-appearance: none !important;
background-color: transparent;
color: black;
}
#downloads-indicator-counter {
color: white;
}
@madeindjs
madeindjs / markdownd_to_wiki.sh
Last active May 15, 2017 09:13
A simple markdown converted to Wiki formating using SED
#!/bin/bash
cat "$1" |
# code block tags
sed -E 's/(~~~|```)([a-z]+)/<pre><code class="\2">/g' |
sed -E 's|(~~~\|```)|</pre></code>|g' |
# inline code tag
sed -E 's/`(.*)`/@\1@/g' |
# italic tag
sed -E 's/\*/_/g' |
@madeindjs
madeindjs / cut_period_between_months.php
Created May 31, 2017 07:12
Slice a given periods into multiples periods cut on months
<?php
/**
* Slice a given periods into multiples periods cut on months
*
* Example: 15/01 - 15/02 = 15/01 - 31/01 : 01/02 - 15/02
*
* @param DateTime $start
* @param DateTime $end
* @yield array whith keys `start` & `end` containing `DateTime` formated

Configurer le fichier ssh

$ cat ~/.ssh/config 
Host pi
  Hostname 5.50.77.180
  Port 2812
  User pi
  IdentityFile ~/.ssh/raspberry.id_rsa
@madeindjs
madeindjs / git_check_php.sh
Created August 9, 2017 13:56
Check git staged PHP files errors
#!/bin/bash
files=`git diff --name-only | grep -E '.php$' `
for file in $files; do
php -l $file > /dev/null
done
@madeindjs
madeindjs / pre-commit
Last active March 16, 2020 10:47
Git hook to store in .git/hooks/ folder to check commit
#!/bin/bash
# .git/hooks/pre-commit
GREEN='\033[0;32m'
RED='\033[0;31m'
DEFAULT='\033[0m'
# loop on all commited PHP files
echo -e "\n${GREEN}Check PHP files${DEFAULT}\n"