Skip to content

Instantly share code, notes, and snippets.

" progressively check higher values... falls out on first "true"
" (note addition of zero ... this guarantees return from function is numeric
if strftime("%H") < 6 + 0
colorscheme darkblue
echo "setting colorscheme to darkblue"
elseif strftime("%H") < 12 + 0
colorscheme morning
echo "setting colorscheme to morning"
elseif strftime("%H") < 18 + 0
colorscheme shine
@Asenar
Asenar / deploy
Last active December 11, 2015 15:29
[draft] deploy with gitolite. This is a draft, feel free to comment. This is not bug free (yet), some push may not work properly. Pushing tags produce an error (or something like that), and there is something by pushing new branches
#!/bin/bash
#
# file : serveur-prod:/home/git/scripts/deploy
# desc : This script deploy a pushed branch in web directory specified in conf/$repo-name.conf
#
# author : Michaël Marinetti
# creation : 2012-09-07
# modified : 2013-01-24
#
# LOG
@Asenar
Asenar / base.js
Last active December 12, 2015 11:58
[not finished] non-intrusive javascript example with pretty notices
function mainfunc (func){
this[func].apply(this, Array.prototype.slice.call(arguments, 1));
}
function debug(e){
if(__d && typeof console != 'undefined'){
console.log(e);
}
}
function error(e){
@Asenar
Asenar / install-server.org
Last active December 13, 2015 20:28
[draft] install server from scratch - gandi. Everything has to be done as root

PART 0 - INTRODUCTION

That’s not really a tutorial. I just took notes of what I did (for doing better next time). I may omit some things, fell free to correct me / complete me in comments or whatever :)

before

  • create your server on the gandi interface, choose expert mode, debian

definitions

  • myserv : The name of my server
  • asenar : can be my username on the server or my username in my local machine

convention

  • let’s say I will surrounds all bloc of code will looks like this:
#!/bin/bash
# get all, separated by space or kind of
tout=$(grep "<virtualhost\|servername" /usr/local/apache/conf/httpd.conf -i \
| sed "s#<VirtualHost\(.*\):[0-9]*>#\1#" \
| sed "s#.*ServerName \(.*\)#\1#" \
)
count = 0;
# newline one / 2
@Asenar
Asenar / gist:5246483
Last active December 15, 2015 10:29
mkdir ~/tmp_working_dir
cd ~/tmp_working_dir
git init full_smalte
cd full_smalte
all_subs="installer framework module.sample tests theme.backoffice theme.frontoffice"
# part 1 : import all
# Six branch doomed to die
@Asenar
Asenar / creer-depot
Last active December 18, 2015 17:59
exemple simple de ce qu'est git rebase :)
git init test
cd test
echo "test" > test1
echo "test" > test2
echo "Dépot exemple" > README
git add . && git ci -m "commit initial"
echo "2eme ligne" >> test1
git add . && git ci -m "ajout une ligne dans test1"
git checkout -b branche1
echo "3eme ligne dans branche1" >> test1
@Asenar
Asenar / nouveau_site
Last active December 19, 2015 08:29
quick script to create new vhost I made a couple years ago when I started to use bash. This is a really basic script with lot of case who can break it. Feel free to comment
#!/bin/bash
# file : nouveau_site
# description : script to quickly create new vhost. script has to be in /usr/local/sbin/nouveau_site
# usage :
# nouveau_site mondomaine.com
EMAILS="user1@domaine.com"
main_ndd="monsite"
source /usr/local/include/custom_lib
@Asenar
Asenar / .vimrc
Created August 25, 2015 09:50
quickstart vimrc file
" put in ~/.vimrc
" {{{ general config
set nocompatible " vim Improved
set t_Co=256 " 256 colors
set ruler " show line and column in status bar
set showcmd " show the current command you're typing
" }}}
" {{{ look and feel
@Asenar
Asenar / file.php.diff
Created July 5, 2016 15:14
wordpress security hack for allowing theme/plugin/images uploads but not core upgrade (with different file owner permissions check)
commit 670110b (HEAD, virageadroite)
Author: Michaël Marinetti <github@marinetti.fr>
Date: 12 minutes ago
Add: security wp-content
diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php
index 078a369..d11c9f3 100644
--- a/wp-admin/includes/file.php
+++ b/wp-admin/includes/file.php