Skip to content

Instantly share code, notes, and snippets.

View osallou's full-sized avatar

Olivier Sallou osallou

View GitHub Profile
@osallou
osallou / gist:4564576
Last active December 11, 2015 07:09
Git pre-commit script to compile scss files to css (same directory) using python scss and add css file to the commit
#!/bin/sh
# Precommit hook to generate css from scss
# Loop over all files included in the commit.
for file in $( exec git diff-index --cached --name-only HEAD )
do
# We only want to take action unless the file is a LESS file.
if [[ $file == *".scss"* ]]; then
@osallou
osallou / gist:4564633
Created January 18, 2013 13:47
How to configure an errbit logger in python config file
To configure a log handler with errbit, add airbrakepy to requirements and add to config file:
[handler_errbitHandler]
class=airbrakepy.logging.handlers.AirbrakeHandler
level=DEBUG
args=(api_key="xxx", environment="dev", component_name="mobyle", node_name="mytestserver", use_ssl=False, timeout_in_ms=3000, airbrake_url="http://localhost:3000/notifier_api/v2/notices")
Do not forget to call logging.shutdown() to clean the logging on application shudown
@osallou
osallou / gist:4656973
Created January 28, 2013 16:28
Git: checkout a remote branch
git checkout -b mybranch origin/mybranch
@osallou
osallou / gist:6120689
Created July 31, 2013 09:28
Cordova build and test
in app dir:
cordova build
cordova emulate (a device must have been set previously with Android Device Manager in Eclipse)
To log:
adb logcat
@osallou
osallou / gist:7804506
Created December 5, 2013 12:37
build-debian-cloud virtualbox log failure
Loaded provider `virtualbox'
Loaded plugin `user_packages'
Tasklist:
<class 'common.tasks.workspace.CreateWorkspace'>
<class 'common.tasks.packages.ImagePackages'>
<class 'plugins.user_packages.user_packages.AddUserPackages'>
<class 'providers.virtualbox.tasks.packages.ImagePackages'>
<class 'common.tasks.packages.HostPackages'>
<class 'common.tasks.host.CheckPackages'>
<class 'common.tasks.loopback.Create'>
@osallou
osallou / gist:7805556
Created December 5, 2013 14:00
debian-build-cloud wheezy build failure on grub
Configuring grub
Executing: /usr/sbin/chroot /target/af963f8b/root /bin/umount /dev/pts
Executing: /usr/sbin/chroot /target/af963f8b/root /bin/umount /sys
Executing: /usr/sbin/chroot /target/af963f8b/root /bin/umount /proc
Executing: /bin/umount /target/af963f8b/root/dev
Executing: /bin/umount /target/af963f8b/root/boot
Executing: /bin/umount /target/af963f8b/root
Executing: /sbin/kpartx -d /dev/loop0
Executing: /sbin/dmsetup create vda
Executing: /sbin/kpartx -l /dev/mapper/vda
@osallou
osallou / gist:7988178
Last active May 2, 2022 14:32
Sample C foreign interface for SWI-Prolog called with my_function('6',N) loaded with :-use_foreign_library(foreign('test.so')). compile: swipl-ld -shared -o test test.c
#include <SWI-Prolog.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct context /* define a context structure */
{
int max;
} context;
foreign_t
@osallou
osallou / gist:10019670
Created April 7, 2014 12:47
Attach a new disk on Debian
http://www.debiantutorials.com/add-a-second-hard-disk/
fdisk -l
cfdisk /dev/sdX
> New -> Primary -> Specify size in MB
> Write
> Quit
@osallou
osallou / gist:11177031
Created April 22, 2014 12:28
Create a patch
diff -crB CMakeLists.txt.orig CMakeLists.txt > cmake.patch
@osallou
osallou / gist:40c37a767160e8cfa1fc
Created May 6, 2014 08:23
bootstrap-vz grub install failure with jessie
Configuring grub
Installing grub
Executing: umount /target/38028fa6/root/dev/pts
Executing: umount /target/38028fa6/root/proc
Executing: umount /target/38028fa6/root/boot
Executing: umount /target/38028fa6/root/sys
Executing: umount /target/38028fa6/root/dev
Executing: umount /target/38028fa6/root
Executing: kpartx -ds /dev/loop0
Executing: dmsetup create vdd