Skip to content

Instantly share code, notes, and snippets.

View msawangwan's full-sized avatar
😎

misha sawangwan msawangwan

😎
View GitHub Profile
@cfm
cfm / README.md
Last active August 21, 2023 06:46
Adapting the twelve-factor methodology for "Qubes-native" multi-VM applications: a preliminary sketch

Adapting the twelve-factor methodology for "Qubes-native" multi-VM applications: a preliminary sketch[^1]

Introduction

Virtualization is the conceptual technology on which modern services (server applications) are built. Whether an application happens to run on a fully- or para-virtualized VM[^2] or is containerized—or even runs on a “bare-metal” physical server after all—most modern services are designed in isolated, replicated, disposable components on commodity hardware.[^3] The [“twelve-factor methodology”][wiggins] (2011) is an influential articulation of the principles

@pratapaditya1997
pratapaditya1997 / postgres-database-migration.md
Last active November 15, 2021 22:43
my first blog article ever. this is on how to migrate postgres database from one server to another

title: "Postgres Database Migration" date: 2020-04-17T21:00:46+05:30 draft: true metaAlignment: center categories: [] tags: []

@asukakenji
asukakenji / go-stdlib-interface-selected.md
Last active May 5, 2024 04:26
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

All of the following information is based on go version go1.8.3 darwin/amd64.

@alextanhongpin
alextanhongpin / time.go
Last active July 3, 2022 20:08
JavaScript timestamp to golang time.Time
package main
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@eunomie
eunomie / README.md
Created April 27, 2017 09:44
How to send containers log to ELK using gelf log driver

Send docker logs to ELK through gelf log driver

There's so many way to send logs to an elk... logspout, filebeat, journalbeat, etc.

But docker has a gelf log driver and logstash a gelf input. So here we are.

Here is a docker-compose to test a full elk with a container sending logs via gelf.

Scaling your API with rate limiters

The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.

In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.

Request rate limiter

This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.

@cmdr2
cmdr2 / GenerateMesh02.cs
Last active November 1, 2023 14:28
A mesh extrusion along a bezier curve (Unity3d)
[RequireComponent(typeof(MeshFilter))]
public class GenerateMesh02 : MonoBehaviour {
/* scratchpad */
private MeshFilter mf;
void Start () {
mf = GetComponent<MeshFilter> ();
GenerateMesh ();
@xjdrew
xjdrew / client.go
Last active January 22, 2024 05:49
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@miglen
miglen / linux-networking-tools.md
Last active April 23, 2024 11:39
Linux networking tools

List of Linux networking tools

netstat (ss)

Displays contents of /proc/net files. It works with the Linux Network Subsystem, it will tell you what the status of ports are ie. open, closed, waiting, masquerade connections. It will also display various other things. It has many different options. Netstat (Network Statistic) command display connection info, routing table information etc. To displays routing table information use option as -r.

Sample output:

Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4 0 0 127.0.0.1.62132 127.0.0.1.http ESTABLISHED
@teknoraver
teknoraver / unixhttpc.go
Last active March 21, 2024 11:48
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"