Skip to content

Instantly share code, notes, and snippets.

@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:
@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 / 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
" 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 / Firstpage.php
Created October 31, 2012 12:06
something like this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<link href="/js/jquery/jquery.cleditor.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.cleditor.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.form.js"></script>
<script type="text/javascript">
$("#myform").submit(function(e){
@Asenar
Asenar / bashrc.bash
Last active October 11, 2015 16:07
script for testing fancy prompt with 2 colors
#!/bin/bash
# list of colors, just what I use for test
txtrst=\[\033[00m\] # no color
txtred=\[\033[31m\] # Red
txtred=\[\033[32m\] # Green
txtblu=\[\033[34m\] # Blue
RANDOM_PROMPT()
{
@Asenar
Asenar / post-receive
Created September 3, 2012 08:11
what's the best way to make this hooks working when the "git fetch" is on an other server ?
read oldrev newrev refname
branch=${refname#refs/heads/}
dir_develop=/home/www/dev.mywebsite.com
dir_master=/home/www/mywebsite.com
mail=michael@mywebsite.com
if (test "$branch" = "develop") then
cd $dir_develop
@Asenar
Asenar / etc-ssh-sshd_config
Created June 21, 2012 12:27
fichier de configuration pour chrooter les utilisateurs qui utilisent ce moyen
1) chown root:sftp /home/web -R
fortement basé sur http://shapeshed.com/chroot_sftp_users_on_ubuntu_intrepid/ , et un grand merci à la communauté freenode/gandi-hosting !
----------------------------------------------------
# Package generated configuration file
# See the sshd_config(5) manpage for details
Etat HTTP 500 -
type Rapport d'exception
message
description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
exception
@Asenar
Asenar / gist:2916695
Created June 12, 2012 10:04
afficher les sauts de ligne dans AdminLogs
$ svn diff
Index: classes/AdminTab.php
===================================================================
--- classes/AdminTab.php (revision 15980)
+++ classes/AdminTab.php (working copy)
@@ -1524,6 +1524,8 @@
echo Tools::displayDate($tr[$key], (int)$cookie->id_lang);
elseif (isset($params['type']) AND $params['type'] == 'datetime')
echo Tools::displayDate($tr[$key], (int)$cookie->id_lang, true);
+ elseif (isset($params['type']) AND $params['type'] == 'log')