Skip to content

Instantly share code, notes, and snippets.

View valeriansaliou's full-sized avatar
💫
Per aspera ad astra

Valerian Saliou valeriansaliou

💫
Per aspera ad astra
View GitHub Profile
@valeriansaliou
valeriansaliou / upgrade_gitlab
Last active August 29, 2015 14:20
GitLab Upgrade Scripts
#!/bin/sh
if [ "$1" ]; then
# Upgrade both GitLab CE + GitLab CI
upgrade_gitlab_ce "$1";
upgrade_gitlab_ci "$1";
else
echo "[upgrade_gitlab] Please feed me with upgrade branch (X-X-stable)"
fi
// CRISP_READY_TRIGGER is read as a "crisp ready" callback
CRISP_READY_TRIGGER = function() {
// Set user email once crisp is ready
$crisp.user.email.set("USER_EMAIL_THERE");
};
@valeriansaliou
valeriansaliou / setup_docker_machine_route_macos.sh
Created January 26, 2016 09:08
Setups the route to Docker machine networking layer
#!/bin/bash
# Script to instruct the Mac how to route packets to the
# software defined network where containers created via boot2docker
# reside. This lets you casually directly to ports (ssh, http, etc. etc.)
# on those containers.
function ERROR(){ echo "ERROR: $*" ; }
function FAIL(){ echo "FAILING: $*" ; exit 1; }
defaults delete com.apple.dock expose-animation-duration; killall Dock
@valeriansaliou
valeriansaliou / letsencrypt_cron_wrapper.sh
Last active November 28, 2016 09:26
Let's Encrypt manual certificate renew for a static private key
#!/bin/bash
# Cron wrapper, call this directly from your cron. Depends on renew script (letsencrypt_manual_renew.sh).
ADMIN_EMAIL=hostmaster@server.tld
RENEWLOG=`/srv/data_server/certs/tools/letsencrypt_manual_renew.sh 2>&1`
rc=$?
if [[ $rc -ne 0 ]]; then

Keybase proof

I hereby claim:

  • I am valeriansaliou on github.
  • I am valerian (https://keybase.io/valerian) on keybase.
  • I have a public key ASAoeFcGq8cTxJMg6NVKnrqOa8YafbxlxNmDmA00RyqURwo

To claim this, I am signing this object:

@valeriansaliou
valeriansaliou / iptables-http-dos-shield.txt
Last active September 21, 2023 07:34
HTTP/HTTPS DOS shield w/ IPTables
# Those rules protect HTTP/HTTPS services for both IPv4 and IPv6 sources as such:
# 1. Prevent a /32 IPv4 or /64 IPv6 to open more than 10 HTTPS?/TCP connections per second (the limit is high, but this still shield against some attacks) — DROP TCP packets in this case, to avoid generating egress traffic sending a RST
# 2. Limit ingress bandwidth to HTTPS? services to 32KB/sec (adjust to your needs, in my case it is used to shield a WebSocket backend against incoming WebSocket message floods)
# 3. Limit the number of simultaneous ongoing connections to HTTPS? to 40 (also, high limit, adjust to your needs)
# The protections those rules offer:
# 1. Prevent crypto-DOS (ie. a client that proceed too many key exchanges and thus exhaust server CPU)
# 2. Prevent WebSocket floodings (eg. I use this for Socket.IO, which has no efficient way to rate-limit received messages before they get parsed)
# 3. Prevent ephemeral TCP port exhaustion due to a client holding too many TCP connections
# 4. Prevent IPv6 rotation attac
@valeriansaliou
valeriansaliou / package.json
Last active April 23, 2021 06:40
Slack archived channels delete
{
"dependencies": {
"request-promise": "4.2.2",
"request": "2.83.0",
"promise-seq": "2.0.1"
}
}
@valeriansaliou
valeriansaliou / sonic-benchmark_batch-push.js
Created March 19, 2019 13:15
Sonic Benchmark: Batch PUSH
var mongoose = require("mongoose");
var SonicChannelIngest = require("sonic-channel").Ingest;
var MessageModel = mongoose.model("message", new mongoose.Schema({
session_id : String,
website_id : String,
type : String,
content : Object
}));
@valeriansaliou
valeriansaliou / sonic-benchmark_batch-query.js
Created March 19, 2019 13:15
Sonic Benchmark: Batch QUERY
var mongoose = require("mongoose");
var SonicChannelSearch = require("sonic-channel").Search;
var MessageModel = mongoose.model("message", new mongoose.Schema({
website_id : String,
type : String,
content : Object
}));
var query_count = 0;