Skip to content

Instantly share code, notes, and snippets.

@chansdad
chansdad / nginx.conf
Created September 24, 2016 21:14 — forked from dnprock/nginx.conf
meteor nginx load balance with sticky session, used by vida.io
# Sticky session module for nginx
# https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/
# nginx configure command: ./configure --with-http_ssl_module --add-module=../nginx-sticky-module-ng/ --sbin-path=/usr/local/sbin --with-http_gzip_static_module
upstream vida_node_server {
sticky path=/;
server 127.0.0.1:3000 max_fails=3 fail_timeout=30s;
server [server2]:3000 max_fails=3 fail_timeout=30s;
}
@chansdad
chansdad / ReceiveTest.cpp
Created November 5, 2018 17:14 — forked from StephanOpfer/ReceiveTest.cpp
Sending Cap'n Proto over ZeroMQ
#include <discovery_msgs/beacon.capnp.h>
#include <zmq.h>
#include <assert.h>
#include <capnp/message.h>
#include <capnp/serialize-packed.h>
#include <iostream>
/**
@chansdad
chansdad / gevent_zmq_redis_demo.py
Created December 19, 2018 22:18 — forked from kaka19ace/gevent_zmq_redis_demo.py
gevent with zmq and redis tasks
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @file gevent_zmq_redis_demo.py
# @author kaka_ace <[email protected]>
# @date Tue Oct 14 2014
"""
fetures: there are two concurrent tasks
1. From Redis server, Getting the notify msg with BLPOP operation,
@chansdad
chansdad / udpproxy.py
Created December 27, 2018 21:37 — forked from vxgmichel/udpproxy.py
UDP proxy server using asyncio
"""UDP proxy server."""
import asyncio
class ProxyDatagramProtocol(asyncio.DatagramProtocol):
def __init__(self, remote_address):
self.remote_address = remote_address
self.remotes = {}
@chansdad
chansdad / setup-zeromq.sh
Created March 11, 2019 18:20 — forked from katopz/setup-zeromq.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@chansdad
chansdad / gist:45b77d22257fb5e1c0006a5b4045374b
Created May 10, 2019 04:23 — forked from baljanak/gist:3979567
Playing with threads, greenlets and ZMQ
import gevent
from gevent import monkey; monkey.patch_all()
from gevent_zeromq import zmq
import simplejson as json
import threading
import time
def server(context):
poll = zmq.Poller()
@chansdad
chansdad / rpi.md
Created June 12, 2019 07:21 — forked from jimyang2008/rpi.md
Raspberry Pi

Notes on Raspberry Pi

Initial default username password for Raspbian

username: pi
password: raspberry

Update Locale to support "US"

Need to add US support in addition to default GB, including language, keyboard, etc.

$ raspi-config

@chansdad
chansdad / graph.js
Created October 20, 2020 06:16 — forked from tpae/graph.js
JavaScript implementation of Graph Data Structure
// Implement a Graph
// basic operations:
// - add vertex (node)
// - add edge (node -> node)
function GraphNode(val) {
this.val = val;
this.edges = {};
}
@chansdad
chansdad / machine.js
Created October 18, 2022 20:43
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@chansdad
chansdad / OpenSourceBaas.md
Created October 31, 2023 06:51 — forked from PARC6502/OpenSourceBaas.md
List of open source, self hosted BaaS - Backend as a service

Backend as a Service

Supabase - ~52K stars

  • Designed explicitly as an open source firebase alternative
  • Typescript based
  • Docker support

Appwrite - ~32K stars

  • Written in JavaScript and PHP
  • Docker based
  • Realtime support across all services