Skip to content

Instantly share code, notes, and snippets.

View 131's full-sized avatar
💭
working on cloudfs

François Leurent 131

💭
working on cloudfs
View GitHub Profile
@131
131 / Save huge directories using svn.md
Last active February 7, 2022 08:49
Save huge directories using svn

Saving big (100GB+) directories with lots of files under subversion will most probably fail (due to timeout/exeeded RAM consumption & co). Instead of One Big Failing Transaction, commit your data in chunks.

#!/bin/bash
# First, commit directory structure
# find -type d |  xargs  -d '\n' svn add --depth=empty
@131
131 / noautofill.md
Last active November 17, 2021 22:58
Prevent autofill / password completion
<textarea required="required" autocorrect="off" autocapitalize="off" name="username" class="form-control" placeholder="Your username"  rows="1" cols="20" wrap="off"></textarea>
<textarea required="required" autocorrect="off" autocapitalize="off" name="password" class="form-control password" placeholder="Your password"  rows="1" cols="20" wrap="off"></textarea>
@font-face {
remote_read:
- url: https://prometheus.gra1.metrics.ovh.net/remote_read
basic_auth:
username: ''
password: '<redacted>'
remote_write:
- url: https://prometheus.gra1.metrics.ovh.net/remote_write
basic_auth:
@131
131 / readdir.js
Created October 14, 2018 21:26
async iterator, are needed
"use strict";
//this requires node 10 magical
const fs = require('fs');
const path = require('path');
const promisify = require('nyks/function/promisify');

minimal curl/wget, with binary file support

function __curl() {
  read proto server path <<<$(echo ${1//// })
  DOC=/${path// //}
  HOST=${server//:*}
  PORT=${server//*:}
  [[ x"${HOST}" == x"${PORT}" ]] && PORT=80
@131
131 / proxy_connect.diff
Created December 27, 2016 00:07
Apache ProxyRemote with Proxy-Authorization (over connect/HTTPS)
Index: mod_proxy.c
===================================================================
--- mod_proxy.c (revision 1205172)
+++ mod_proxy.c (working copy)
@@ -965,7 +965,8 @@
access_status = proxy_run_scheme_handler(r, worker,
conf, url,
ents[i].hostname,
- ents[i].port);
+ ents[i].port,
@131
131 / gist:4c782158e61921323a9445fbe13563d4
Last active October 11, 2016 22:53
Static context in ES6 classes

Long story short, in javascript "this" refer to the thing-on-the-left-side-of-the-dot. period.

So, when writing ES6 classes & statics methods, use "this" to refer to the static classe.

class User {
<?
function stop(){
if(!file_exists(self::PID_FILE))
return;
$pid = file_get_contents(self::PID_FILE);
posix_kill($pid, SIGTERM);
unlink(self::PID_FILE);
rbx::ok("Stopped $pid");
}
var ClapEngine = require('clap-trigger');
var hue = require("node-hue-api");
var HueApi = hue.HueApi;
var lightState = hue.lightState;
var hostname = "192.168.131.47";
var user_id = 'iwonttell';
var api = new HueApi(hostname, user_id);
var trigger = new ClapEngine();
@131
131 / pg-async-transactions.js
Last active April 24, 2016 20:50
Proposal for pg-async transaction stack
"use strict";
var values = function(obj){
var val = []
Object.keys(obj).forEach(function(key) {
val.push(obj[key]);
});
return val;
};