Skip to content

Instantly share code, notes, and snippets.

@irr
irr / aws_pandas_layer.md
Created December 6, 2022 13:29 — forked from antoinedelia/aws_pandas_layer.md
How to make a Python pandas Layer for AWS Lambda

How to make pandas as an AWS layer

  1. Install pandas to local directory with pip: pip install -t . pandas

  2. Remove pandas and numpy directories rm -r pandas numpy

  3. Download the Linux distribution for pandas (choose the Python version that you want to use): https://pypi.org/project/pandas/#files

  4. Download the Linux distribution for numpy (must be the same as the pandas one): https://pypi.org/project/numpy/#files

@irr
irr / LearnGoIn5mins.md
Created January 14, 2021 10:08 — forked from prologic/LearnGoIn5mins.md
Learn Go in ~5mins
@irr
irr / capped_json.sql
Created April 22, 2020 06:52 — forked from bitdivine/capped_json.sql
Postgres capped collection
-- Capped collection of JSON blobs: (Use json for postgres 9.4 and below and jsonb for 9.5 and above)
CREATE SEQUENCE circle_index START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 5 CACHE 1 CYCLE ;
CREATE TABLE circle ( i integer PRIMARY KEY default nextval('circle_index') NOT NULL, tim timestamp DEFAULT current_timestamp NOT NULL, dat jsonb );
INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":1}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat;
INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":2}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat;
INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":3}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat;
INSERT INTO circle(i, dat) SELECT nextval('circle_index') as idx, '{"a":12345,"b":4}' AS val ON CONFLICT (i) DO UPDATE SET i=EXCLUDED.i, tim=DEFAULT, dat=EXCLUDED.dat;
INSER
### Keybase proof
I hereby claim:
* I am irr on github.
* I am irr (https://keybase.io/irr) on keybase.
* I have a public key ASCaFyNLZZ6VPZe1-paKfPfKRUO_4DQAbqDG_zQVJSLNmgo
To claim this, I am signing this object:
local account = "blah@gmail.com" -- use your own gmail account
local password = "password" -- if you enable 2-phase authentication, you need to
-- generate and use a application-specific password here...
local sender_name = "Jon Snow"
local recipient = "recipient@foo.com"
local recipient_name = "Arya Stark"
--------------------------------------------------------
local find = ngx.re.find
local account = "blah@gmail.com" -- use your own gmail account
local password = "password" -- if you enable 2-phase authentication, you need to
-- generate and use a application-specific password here...
local sender_name = "Jon Snow"
local recipient = "recipient@foo.com"
local recipient_name = "Arya Stark"
local mail_title = "This is a test mail"
local mail_body = [[<html><body><p>Mail Body...</body></html>]]
@irr
irr / module.md
Created May 11, 2016 18:22 — forked from dvirsky/module.md

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it!

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
@irr
irr / Monaco_Linux-Powerline.ttf
Created April 10, 2016 19:58 — forked from epegzz/Monaco_Linux-Powerline.ttf
Monaco for vim-powerline
@irr
irr / initial_calls.erl
Created November 11, 2015 12:19 — forked from rlipscombe/initial_calls.erl
Finding leaked processes in Erlang
lists:sort(fun({_, X}, {_, Y}) -> X > Y end,
dict:to_list(lists:foldl(
fun(Pid, Dict) ->
InitialCall = case erlang:process_info(Pid, initial_call) of
{initial_call,{proc_lib,init_p,A}} ->
case erlang:process_info(Pid, dictionary) of
{dictionary, D} -> proplists:get_value('$initial_call', D, undefined);
_ -> {proc_lib,init_p,A}
end;
{initial_call,IC} ->
@irr
irr / tsws
Last active September 6, 2015 15:58 — forked from dfletcher/tsws
Totally simple web server using Bash and netcat (nc)
#!/bin/bash
# --------------------------------
# Totally Simple Web Server (TSWS)
# --------------------------------
#
# (c) 2015 Dave Fletcher
# All Rights Reserved
#
# This is free and unencumbered software released into the public domain.