Skip to content

Instantly share code, notes, and snippets.

View BastienDurel's full-sized avatar

Bastien Durel BastienDurel

View GitHub Profile
// ==UserScript==
// @name patch carbon dashboard
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Bastien Durel
// @match https://carbon.geekwu.org/dashboard
// @icon https://www.google.com/s2/favicons?domain=geekwu.org
// @grant none
// ==/UserScript==
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@BastienDurel
BastienDurel / Makefile
Last active August 29, 2015 14:17
inproc test
SRC=main.cpp
OBJ=$(SRC:.cpp=.o)
OPT=-g -O2
ifneq ($(THREADS),)
OPT+=-DNUM_THREADS=$(THREADS)
endif
ifeq ($(WORK),1)
OPT+=-DWORK
@BastienDurel
BastienDurel / Makefile
Last active August 29, 2015 14:15
push/pull test
SRCC=client.cpp
SRCS=server.cpp
OBJC=$(SRCC:.cpp=.o)
OBJS=$(SRCS:.cpp=.o)
ifneq ($(NOKEEPALIVE),1)
KA=-DDOKEEPALIVE=1
endif
OPT=-g -O2
@BastienDurel
BastienDurel / test-db-oracle.pl
Created February 19, 2014 11:34
DBD::Oracle::db do failed: ORA-14452: attempt to create, alter or drop an index on temporary table already in use (DBD ERROR: error possibly near <*> indicator at char 15 in 'drop table SYS.<*>test_foobar') [for Statement "drop table SYS.test_foobar"] at test-dbi-oracle.pl line 17.
#!/usr/bin/perl
use strict;
use warnings;
use DBI qw(:sql_types);
use DBD::Oracle qw(:ora_session_modes);
my $run = 1;
$SIG{INT} = sub { $run = 0; print "Stopping ...\n"; };
@BastienDurel
BastienDurel / gist:8978392
Created February 13, 2014 16:25
thread/fork
#!/usr/bin/perl
use strict;
use threads;
use Proc::Daemon;
sub do_nothing {
sleep 1 while 1;
}
threads->create(\&do_nothing);
@BastienDurel
BastienDurel / repro-gerror-bug.pl
Last active December 22, 2015 03:29
Trigger gerror bug in perl-gtk3
#!/usr/bin/perl -CSD
use strict;
use warnings;
use Gtk3 -init;
use Gtk3::WebKit qw(:xpath_results :node_types);
use Data::Dumper;
use Carp;
$SIG{ __DIE__ } = sub { Carp::confess( @_ ) };