Skip to content

Instantly share code, notes, and snippets.

View bermi's full-sized avatar

Bermi Ferrer bermi

View GitHub Profile
@MaxHalford
MaxHalford / ogd-in-sql.ipynb
Created March 7, 2023 12:32
Online gradient descent written in SQL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bermi
bermi / template.sh
Last active February 4, 2022 17:18
Simple bash and sed templating using delimiters.
#!/usr/bin/env bash
# Simple bash and sed templating using delimiters.
#
# For example, given a template /template-a with the contents
#
# # This is template A
# #
# ### EXAMPLE_TEMPLATE_BEGIN
# echo "Hello from template A"
@kafkasl
kafkasl / sp500_constituents.json
Created March 7, 2019 13:47
List of S&P 500 historical constituents from 2008/01/31 to 2019/02/27. JSON format where each date contains a list of the constituents.
This file has been truncated, but you can view the full file.
{
"2008/01/31":[
"GHC",
"MDP",
"GAS",
"AZO",
"MIL",
"MXA",
"ASH",
"SNA",
var localStorage = require("crudlet-local-storage");
var http = require("crudlet-http");
var crud = require("crudlet");
var localdb = crud.tailable(localStorage());
var opsdb = crud.child(localdb, { collection: "operations" });
var api = http({ prefix: "/api" });
// hit the API first, then fallback to local storage if
// api doesn't properly persist
@felixge
felixge / command.sh
Created October 29, 2011 13:43
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
<?php
// Define the 'class' class
$class = Obj()
->fn('new', function ($class) {
$newClass = Obj($class->methods)
->fn('new', function($class) {
$obj = Obj($class->imethods);
$args = func_get_args();
array_shift($args);
@paulirish
paulirish / gist:366184
Created April 14, 2010 18:59
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
// doublecheck the ClientLocation results because it may returning null results
;(function(geolocation){
if (geolocation) return;