Skip to content

Instantly share code, notes, and snippets.

View bertrandmartel's full-sized avatar
💤
👀

Bertrand Martel bertrandmartel

💤
👀
View GitHub Profile
@bertrandmartel
bertrandmartel / ace.vue
Created April 20, 2020 21:50
Ace editor using vue.js
<template>
<div :id="editorId" class="editor">
</div>
</template>
<script>
import * as ace from 'brace';
import 'brace/mode/yaml';
import 'brace/theme/monokai';
export default {
@bertrandmartel
bertrandmartel / migrate.sh
Created April 14, 2020 01:42
Migrate from DocumentDB to DocumentDB using mongodump/mongorestore
mongodump --host [HOST] --username [USER] \
--password [PASSWORD] --db rfp --authenticationDatabase admin \
--readPreference secondary --ssl --sslCAFile rds-combined-ca-bundle.pem --sslAllowInvalidCertificates
mongorestore --uri="mongodb://<target_username>:<target_password>@<target_host>/?authSource=admin&replicaSet=rs0" \
--ssl --sslCAFile rds-combined-ca-bundle.pem --sslAllowInvalidCertificates \
--numInsertionWorkersPerCollection 64 dump
@bertrandmartel
bertrandmartel / git_curl.sh
Last active March 11, 2022 16:48
Using git & curl behind a NTLM proxy
# GIT
# Download latest version of git (portable if not admin)
git.exe clone https://github.com/bertrandmartel/st7735-raspberry.git \
-c "http.proxy=http://:@proxy_url:proxy_port" \
-c "http.sslverify=false" \
-c "credential.helper="
#credential.helper prevents credentials dialog window
#sslverify=false for git host where ca is not recognized
#!/bin/bash
mongodump --uri=mongodb+srv://<src_username>:<src_password>@<src_host>/<your_database> \
--readPreference secondary
mongorestore --uri="mongodb://<target_username>:<target_password>@<target_host>/?authSource=admin&replicaSet=rs0" \
--ssl --sslCAFile rds-combined-ca-bundle.pem --sslAllowInvalidCertificates \
--numInsertionWorkersPerCollection 64 dump
@bertrandmartel
bertrandmartel / multi_buttons.ino
Last active March 10, 2020 14:43
drive 8 buttons simultaneously with Arduino
const int buttonPin0 = A5;
const int buttonPin1 = A4;
const int buttonPin2 = A3;
const int buttonPin3 = A2;
const int buttonPin4 = A1;
const int buttonPin5 = A0;
const int buttonPin6 = 2;
const int buttonPin7 = 3;
#define BTN_COUNT 8
@bertrandmartel
bertrandmartel / Dockerfile
Created January 24, 2020 22:30
Docker configuration for using FLIF CLI tool (Free Lossless Image Format)
FROM debian:10
MAINTAINER Bertrand Martel
RUN apt-get -qq update && \
apt-get -y install libpng-dev libsdl2-dev
RUN apt-get -y install git wget unzip build-essential
WORKDIR /data
@bertrandmartel
bertrandmartel / bytel_conso.py
Last active October 30, 2019 16:31
Conso mobile depuis https://bouyguestelecom.fr en Python3
import requests
from bs4 import BeautifulSoup
import re
import base64
import json
import sys
from random import choice
from string import ascii_uppercase
from urllib.parse import urlsplit, parse_qs
import jwt
@bertrandmartel
bertrandmartel / applet.js
Created October 31, 2018 18:02
node.js script to check an IFTTT applet programmatically
const rp = require('request-promise');
const cheerio = require('cheerio');
const to = require('await-to-js').to;
const cookieJar = rp.jar();
var username = 'YOUR_USERNAME';
var password = 'YOUR_PASSWORD';
var slug = 'your_service_staging';
var appletId = '88014779d';
var userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36';
@bertrandmartel
bertrandmartel / check_applet.sh
Last active October 31, 2018 18:02
A bash script checking an IFTTT applet using curl and pup
#!/bin/bash
rm -f cookies.txt
username="YOUR_USERNAME"
password="YOUR_PASSWORD"
slug="some_service_staging"
applet_id="88014779d"
@bertrandmartel
bertrandmartel / liblouis-test.c
Created October 5, 2018 23:30
testing liblouis in a super simple program (liblouis & libunistring are needed)
//gcc -I/usr/local/include/liblouis -l louis -l unistring liblouis-test.c
#include <stdio.h>
#include <stdlib.h>
#include "liblouis.h"
#include "internal.h"
#include "unistr.h"
int main(int argc, char **argv) {
char * input = "hello world";