Skip to content

Instantly share code, notes, and snippets.

View velimir's full-sized avatar
🤓
Excited

Grigory Starinkin velimir

🤓
Excited
  • United Kingdom, London
  • 08:46 (UTC +01:00)
View GitHub Profile
@jtratner
jtratner / generate_typed_dicts.py
Created April 10, 2018 00:32
Example of auto generating type stubs
from datetime import datetime
STRING_DEFAULT = 'string'
DATETIME_DEFAULT = datetime(2015, 1, 1)
INT_DEFAULT = 123
def generate_typed_dicts(name, nested_dict):
full_context = []
final_dict = [f"class {name}(TypedDict):"]
@alexcasalboni
alexcasalboni / aws-lambda-static-type-checker.md
Last active May 22, 2023 07:31
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@webframp
webframp / keybase.md
Created July 25, 2017 18:14
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key

@rcknr
rcknr / README.md
Last active July 19, 2018 12:36
Using Let's Encrypt certificates with Amazon API Gateway

##Using Let's Encrypt certificates with AWS API Gateway

Before starting off with API Gateway set up it's worth mentioning that certificate configuration for this particular service is so far isn't well integrated, therefore different from other AWS services. Despite it using CloudFrount to serve on custom domains it won't let you customize distributions it creates, however all the limitations of CloudFront naturally apply to API Gateway. The most important in this case is the size of the key, which is limited by 2048 bit. Many tutorials provide ready to use terminal commands that have the key size preset at 4096 bit for the sake of better security. This won't work with API Gateway and you'll get an error message about certificate's validity or incorrect chain which won't suggest you the real cause of the issue. Another consideration is that to add a custom domain to API Gateway you have to have a certif

@id
id / gist:cba5dbf7653d7eab6a03
Last active March 26, 2024 15:55
Tracing in erlang
F = fun(F, Fd) -> receive stop -> io:format(Fd, "stop~n", []), file:close(Fd), ok; Msg -> io:format(Fd, "~p~n", [Msg]), F(F, Fd) end end.
{ok, Fd} = file:open("/tmp/trace.out", [write]), Tracer = proc_lib:spawn(fun() -> F(F, Fd) end).
%% trace everything
erlang:trace(Pid, true, [all, {tracer, Tracer}]).
%% stop tracing
erlang:trace(Pid, false, [all, {tracer, Tracer}]).
Tracer ! stop.
%% match pattern
@dergachev
dergachev / ssh-forward-clipboard.md
Last active May 8, 2024 09:15
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@debasishg
debasishg / gist:8172796
Last active May 10, 2024 13:37
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t