Skip to content

Instantly share code, notes, and snippets.

View jonathanGB's full-sized avatar

Jonathan Guillotte-Blouin jonathanGB

View GitHub Profile
@jonathanGB
jonathanGB / cl-noria-insert.rs
Created December 16, 2019 23:13
Noria insert script with command-line flags
extern crate structopt;
use structopt::StructOpt;
use noria::{ControllerHandle, DataType};
#[derive(StructOpt, Debug)]
#[structopt(name = "noria-script")]
pub struct Config {
deployment: String,
#[structopt(long = "no-insert")]
@jonathanGB
jonathanGB / 6-col.rs
Created December 16, 2019 22:43
Noria - 6-col insert script
use noria::{ControllerHandle, DataType};
#[tokio::main]
async fn main() {
let vote_sql = "CREATE TABLE Vote (aid int, bid int, cid int, did int, eid int, uid int);";
let range_sql = "QUERY VoteEquiAndInequality: \
SELECT * \
FROM Vote \
WHERE aid = ? AND bid = ? AND cid = ? AND did = ? AND eid = ? AND uid >= ? AND uid < ?;";
@jonathanGB
jonathanGB / makefile
Created January 23, 2018 19:49
makefile to run opencv3 installed with HomeBrew
g++ -o <NAME_OF_EXECUTABLE> -std=c++11 *.cpp `pkg-config --cflags --libs /usr/local/Cellar/opencv/3.4.0_1/lib/pkgconfig/opencv.pc`
const methodData = [{
supportedMethods: ["basic-card"],
data: {
supportedNetworks: ['visa', 'mastercard'],
supportedTypes: ['debit']
}
}, {
supportedMethods: ["https://example.com/bobpay"],
data: {
merchantIdentifier: "XXXX",
@jonathanGB
jonathanGB / try-tries.cpp
Last active November 23, 2016 20:40
Tries : Contacts
// c++ solution
#include <iostream>
using namespace std;
struct Node {
int count;
Node* next;
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:head>
<title>Consulter profils</title>
</h:head>
private boolean getUser(String userId) {
Query query = em.createQuery(
"SELECT u FROM UserProfile u" +
" WHERE u.emailId = :emailId");
query.setParameter("emailId", userId);
System.err.println("after creation");
ArrayList<UserProfile> results = performQuery(query);
System.err.println("after performed");
if (results == null)
@jonathanGB
jonathanGB / parseData.py
Last active October 13, 2016 16:04
sql dump with python
import os, sys, csv, psycopg2, argparse
# db variables
db = {
'dbname': 'db2-project',
'user': 'boubou',
'host': 'localhost',
'password': ''
}
try:
@jonathanGB
jonathanGB / menu-item.js
Created October 5, 2016 14:19
Change this in electron (/lib/browser/api/menu-item.js)
'use strict'
const roles = require('./menu-item-roles')
let nextCommandId = 0
const MenuItem = function (options) {
const {Menu} = require('electron')
Object.assign(this, options)
@jonathanGB
jonathanGB / gist:89da9cac05ade1642087
Created January 5, 2016 09:30
IFTTT: Track Your Work Hours - Upgraded
# Upgrade to the "DO" recipe "Track Your Work Hours" by @dmerrick
# To use, connect to the recipe (https://ifttt.com/recipes/227069-track-your-work-hours) and change the "Formatted Row" content with the one below.
# It gives the time in "HHhMM" format of a work time, and the total of all work times in the same readable format.
{{OccurredAt}} ||| =IF(ISODD(ROW()), "Started", "Stopped") ||| =IF(ISEVEN(ROW()),ROUND(((DATEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4)), "\w+ \d{2}, \d{4}")) + TIMEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW(),COLUMN()-2,4)), "\d{2}:\d{2}[A|P]M$"))) - ( DATEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW()-1,COLUMN()-2,4)), "\w+ \d{2}, \d{4}")) + TIMEVALUE(REGEXEXTRACT(INDIRECT(ADDRESS(ROW()-1,COLUMN()-2,4)), "\d{2}:\d{2}[A|P]M$")))) * 24, 2),"") ||| =if(ISEVEN(ROW()), CONCATENATE(IFERROR(CONCAT(REGEXEXTRACT(text(INDIRECT(ADDRESS(ROW(), COLUMN() -1, 4)), "###.##"), "^\d+"),"h"), ""), ROUND(60* VALUE(REGEXEXTRACT(text(INDIRECT(ADDRESS(ROW(), COLUMN() -1, 4)), "###.###"), "\.\d*"))), "