Skip to content

Instantly share code, notes, and snippets.

View madeindjs's full-sized avatar
💩

Alexandre Rousseau madeindjs

💩
View GitHub Profile
@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
@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 / 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 / .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 / 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 / .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 / 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 / Rakefile
Last active April 7, 2017 08:54
My Rakefile
require 'git'
require 'fileutils'
require 'date'
require 'pathname'
desc "Print directory-tree"
task :tree, [:folder, :folder_only] do |t, args|
args.with_defaults(:folder_only => false)
$folder_only = args.folder_only == "true"
@madeindjs
madeindjs / bootstrap.sh
Last active April 6, 2017 08:09
Basic setup for Linux mint developper desktop
#!/bin/bash
green='\e[0;32m'
darkred='\e[1;31m'
lightblue='\e[1;34m'
default='\033[0m'
echo -e "${darkred}***Bootstrap Linux Mint setup***${default}"
@madeindjs
madeindjs / Sketchup_improve_2015_to_2016.rb
Created December 9, 2016 16:09
A Sketchup script to do boring stuff tu improve my 2015 library to 2016
# Edit materials
Sketchup.active_model.materials.to_a.each do |mat|
case mat.name
when / Ext/
Sketchup.active_model.materials.remove(mat) unless mat.deleted?
when / Int/