Skip to content

Instantly share code, notes, and snippets.

View mdjaman's full-sized avatar
🏠
Abidjan, Ouagadougou, Niamey, Kinshasa

Marcel Djaman mdjaman

🏠
Abidjan, Ouagadougou, Niamey, Kinshasa
View GitHub Profile
@mdjaman
mdjaman / git_untrack_directory
Created October 24, 2016 11:50
git: untrack directory
git rm -r --cached one-of-the-directories
git commit -m "Remove duplicated directory"
git push origin master
@mdjaman
mdjaman / strip_tags.js
Created September 26, 2016 12:24 — forked from muhittin/strip_tags.js
strip_tags for Javascript
var text = '<div class="foo">bar</div>';
text.replace(/(<([^>]+)>)/ig,""); // Returns: bar
@mdjaman
mdjaman / install.sh
Created August 19, 2016 10:06 — forked from Fridus/install.sh
Install wkhtmltopdf
#!/usr/bin/env bash
_UVERSION=${1:-precise}
_WVERSION=0.12.2.1
_WVERSION_M=`echo $_WVERSION | awk -F. '{print $1"."$2}'`
FILENAME="wkhtmltox-${_WVERSION}_linux-${_UVERSION}-amd64.deb"
URL="http://download.gna.org/wkhtmltopdf/${_WVERSION_M}/${_WVERSION}/${FILENAME}"
apt-get update
@mdjaman
mdjaman / backup.sh
Created August 18, 2016 21:11 — forked from karussell/backup.sh
Backup ElasticSearch with rsync
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing
@mdjaman
mdjaman / supervisord-example.conf
Created August 18, 2016 21:08 — forked from didip/supervisord-example.conf
Example for supervisord conf file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@mdjaman
mdjaman / test.js
Created June 30, 2016 15:05 — forked from mscdex/test.js
sharing sessions between node.js and php using redis
var express = require('express'),
app = express(),
cookieParser = require('cookie-parser'),
session = require('express-session'),
RedisStore = require('connect-redis')(session);
app.use(express.static(__dirname + '/public'));
app.use(function(req, res, next) {
if (~req.url.indexOf('favicon'))
return res.send(404);
@mdjaman
mdjaman / gist:c9bc76269035157d6b977312e44303c8
Created May 25, 2016 10:46 — forked from tairov/gist:11289983
php, rabbitmq, delayed messages
// include the AMQPlib Classes || use an autoloader
// queue/exchange names
$queueRightNow = 'right.now.queue';
$exchangeRightNow = 'right.now.exchange';
$queueDelayed5sec = 'delayed.five.seconds.queue';
$exchangeDelayed5sec = 'delayed.five.seconds.exchange';
$delay = 5; // delay in seconds
<?php
/**
* This file is part of the Inventory project
* Copyright (c) 2016
* @author Marcel Djaman <marceldjaman@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@mdjaman
mdjaman / generator.php
Created December 4, 2015 20:18 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@mdjaman
mdjaman / application.js
Created November 28, 2015 12:43 — forked from dshaw/application.js
socket.io application and haproxy configuration
var express = require('express');
var redis = require('redis');
const serverType = process.argv[2];
const serverHost = process.argv[3];
const serverPort = parseInt(process.argv[4]);
const redisPort = 6379;
const redisHost = '127.0.0.1';