Skip to content

Instantly share code, notes, and snippets.

View solisoft's full-sized avatar
🏠
Working from home

BONNAURE Olivier solisoft

🏠
Working from home
View GitHub Profile
@solisoft
solisoft / pg_migrate.cr
Last active August 27, 2015 07:27
Migration tool for crystal web frameworks
# prosgres Migration tool for crystal frameworks
# just create a ./db folder and add some migrations files
# ./db/0.sql
# ./db/1.sql
# ...
# ./db/22.sql # and so on ...
#
# Usage :
# require "pg" # I use a modified version solisoft/crystal-pg for now until main repo deployed
#include "gwan.h" // G-WAN API
#pragma link "hiredis"
#include "hiredis/hiredis.h"
typedef struct
{
redisContext *rCont;
redisReply *rReply;
} data_t;
@solisoft
solisoft / nginx.conf
Last active August 29, 2015 14:02
mrdrive nginx basic file
#user nobody;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@solisoft
solisoft / nginx
Created June 18, 2014 17:28
nginx upstart
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu or other *nix.
# Description: nginx init.d dash script for Ubuntu or other *nix.
### END INIT INFO
@solisoft
solisoft / cookie.rb
Created May 8, 2014 12:33
Ruby + gwan headers
#pragma link "Cello"
#include "gwan.h" // G-WAN API
#include "Cello.h"
int main(int argc, char *argv[])
{
var int_item = $(Int, 5);
xbuf_xcat(get_reply(argv), "Hello World %d", as_long(int_item));
return 200; // HTTP status (200:'OK')
}
@solisoft
solisoft / import.js
Created March 8, 2013 17:04
import.js
// Ok First add a blank layout
var e = document.createElement("div");
e.setAttribute("style", 'position:fixed;background: #fff;background: rgba(255,255,255,0.9); z-index: 100000;top:0;left:0;right:0;bottom:0;');
e.setAttribute("id", "beli_imgs");
document.body.appendChild(e);
var html = "<h1 style='text-align:center; color: orange; font-size: 20px;'>Beli Import</h1><div style='position:fixed; right:0; top: 0; padding: 10px;'><a href='javascript:document.getElementById(\"beli_imgs\").remove()'>Cancel</a></div>";
html += "<div align='center' style='position:fixed; top:0; left: 0; right: 0; bottom:0; margin-top: 40px;'>";
@solisoft
solisoft / import.js
Created March 8, 2013 17:04
import.js
// Ok First add a blank layout
var e = document.createElement("div");
e.setAttribute("style", 'position:fixed;background: #fff;background: rgba(255,255,255,0.9); z-index: 100000;top:0;left:0;right:0;bottom:0;');
e.setAttribute("id", "beli_imgs");
document.body.appendChild(e);
var html = "<h1 style='text-align:center; color: orange; font-size: 20px;'>Beli Import</h1><div style='position:fixed; right:0; top: 0; padding: 10px;'><a href='javascript:document.getElementById(\"beli_imgs\").remove()'>Cancel</a></div>";
html += "<div align='center' style='position:fixed; top:0; left: 0; right: 0; bottom:0; margin-top: 40px;'>";
@solisoft
solisoft / beli.js
Last active December 14, 2015 16:49
beli.io import script
// Ok First add a blank layout
var e = document.createElement("div");
e.setAttribute("style", 'position:fixed;background: #fff;background: rgba(255,255,255,0.9); z-index: 100000;top:0;left:0;right:0;bottom:0;');
e.setAttribute("id", "beli_imgs");
document.body.appendChild(e);
var html = "<h1 style='text-align:center; color: orange; font-size: 20px;'>Beli Import</h1><div style='position:fixed; right:0; top: 0; padding: 10px;'><a href='javascript:document.getElementById(\"beli_imgs\").remove()'>Cancel</a></div>";
html += "<div align='center' style='position:fixed; top:0; left: 0; right: 0; bottom:0; margin-top: 40px;'>";
aptitude update
aptitude install ruby1.9.1 libsqlite3-dev -y
wget http://gwan.com/archives/gwan_linux64-bit.tar.bz2
tar -xf gwan_linux64-bit.tar.bz2
mv gwan_linux64-bit /home/gwan
cd /home/gwan
mv 0.0.0.0_8080/ 0.0.0.0_80
rm 0.0.0.0_80/#0.0.0.0/csp/tidy.c
/home/gwan/gwan -d