Skip to content

Instantly share code, notes, and snippets.

View Hiestaa's full-sized avatar

Romain G Hiestaa

View GitHub Profile
@Hiestaa
Hiestaa / parser.js
Last active August 17, 2022 15:17
Dwell Time Test Suite - Test Chain Data Linking with Dummy Dwell Time Events
/** Data Link Configuration:
{
"dataLink": {
"details.scheduledActivity": {
"match": [
"cameras.$any.id"
],
"window": [
86400,
0
@Hiestaa
Hiestaa / parser.js
Last active July 12, 2022 14:55
Alarm Triggers Parser Test Suite
const LAG = 3 * 60 * 1000;
const GAP = 10 * 1000;
dataReceived = function () {
};
function startTime() {
return new Date(Date.now() - LAG).toISOString();
}
@Hiestaa
Hiestaa / parser.js
Last active June 26, 2023 18:26
Dummy Transaction Parser
let count = 0;
const INTERVAL = 120 * 1000;
const INTERVAL_VARIATION_RANGE = 120 * 1000;
const LAG = Math.round((1 + Math.random() * 10) * 60 * 1000);
const LIMIT = 1000;
const EMPLOYEES = [
"Mana Kujawa",
"Carissa Ledesma",
"Beverly Murrow",
"Melodi Lovick",
@Hiestaa
Hiestaa / iterm2_switch_automatic.md
Created May 5, 2020 19:20 — forked from FradSer/iterm2_switch_automatic.md
Switch iTerm2 color preset automatic base on macOS dark mode.
  1. Add switch_automatic.py to ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch with:
#!/usr/bin/env python3

import asyncio
import iterm2

async def main(connection):
    async with iterm2.VariableMonitor(connection, iterm2.VariableScopes.APP, "effectiveTheme", None) as mon:
@Hiestaa
Hiestaa / overload.js
Created September 20, 2019 19:46
Overload a webserver with a large number of queries for testing purposes (don't be a dick...)
var argv = require('yargs')
.usage('Usage: $0 -n num -q url[?queryString] [-m method] [-b body]')
.demandOption(['n', 'q'])
.argv;
var axios = require('axios');
promises = []
Promise.all([...Array(parseInt(argv.n, 10))].map((data, index) => {
let p
@Hiestaa
Hiestaa / echo.js
Last active September 20, 2019 19:02
Minimalist http echo server. Replies with the method, url, query and (json) body received on any endpoint. Run with `npm install && npm start`.
var express = require("express"),
app = express();
var bodyParser = require('body-parser');
function echo(req, res, next) {
const queryStr = Object.entries(req.query).map(([key, val]) => `${key}=${val}`).join('&');
const bodyStr = req.body ? JSON.stringify(req.body) : null;
const response = req.method + ' ' + req.url + (queryStr && queryStr.length ? '?' + queryStr : '') + '\n' + (bodyStr ? bodyStr + '\n' : '');
console.log(response);
res.end(response);
#!/bin/bash
for i in "$@"
do
case $i in
-p=*|--password=*)
PASSWORD="${i#*=}"
;;
-s=*|--servername=*)
SERVERNAME="${i#*=}"
@Hiestaa
Hiestaa / keybase.md
Created June 8, 2018 15:24
keybase.md

Keybase proof

I hereby claim:

  • I am hiestaa on github.
  • I am rguyot (https://keybase.io/rguyot) on keybase.
  • I have a public key ASC0-5kzdP4c6U26wLFOIfwhtLH6aiqvkMyl9Z_gdy1LLAo

To claim this, I am signing this object:

@Hiestaa
Hiestaa / killListener.py
Created October 6, 2017 16:15
Got a pesky process listening on a specific port and wanna get rid of it? Run `python killListener.py [port]`. Additional `name` argument can be given to filter out processes going to get killed by name.
import subprocess
import sys
if len(sys.argv) > 1:
port = sys.argv[1]
else:
port = '3996'
if (len(sys.argv) > 2):
name = sys.argv[2]
@Hiestaa
Hiestaa / mongorestore-per-collection.sh
Last active June 21, 2017 20:15
mongorestore too many open files error workaround with per collection restore
#!/bin/bash
if [ $# -eq 0 ]; then
echo "usage: `basename $0` pathToDb [dbName]"
exit 1
fi
pathToDb=$1
if [ $# -eq 1 ]; then