Skip to content

Instantly share code, notes, and snippets.

@leandrotoledo
leandrotoledo / main.py
Last active February 2, 2024 00:08
Webhook using self-signed certificate and Flask (with python-telegram-bot library)
#!/usr/bin/env python
'''Using Webhook and self-signed certificate'''
# This file is an annotated example of a webhook based bot for
# telegram. It does not do anything useful, other than provide a quick
# template for whipping up a testbot. Basically, fill in the CONFIG
# section and run it.
# Dependencies (use pip to install them):
# - python-telegram-bot: https://github.com/leandrotoledo/python-telegram-bot
@romanz
romanz / fullnode.md
Last active March 20, 2024 19:05
Bitcoin Full Node on AWS Free Tier

Bitcoin Full Node on AWS Free Tier

Provisioning

  • Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
  • Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
  • Attach 40GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.

The pricing should be ~3$ for the first year (assuming 30GB upload per month). See here for more details.

@jboner
jboner / akka-cluster-implementation-notes.md
Last active March 4, 2023 22:30
Akka Cluster Implementation Notes

Akka Cluster Implementation Notes

Slightly disorganized but reasonably complete notes on the algorithms, strategies and optimizations of the Akka Cluster implementation. Could use a lot more links and context etc., but was just written for my own understanding. Might be expanded later.

Links to papers and talks that have inspired the implementation can be found on the 10 last pages of this presentation.

Akka Gossip

Gossip state

This is the Gossip state representation:

# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@ErikHellman
ErikHellman / Activity showing surface switch
Created June 22, 2013 09:17
A simple demo of playing a video on one SurfaceView and switching to another during playback.
package com.example.mediaplayersurfaceswitch;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import sys
import gevent
from gevent.monkey import patch_all; patch_all()
from gevent import server, event, socket
from multiprocessing import Process, current_process, cpu_count
"""
Simple multiprocess StreamServer that proxies messages between clients.
Avoids using a multiprocessing.Event since it blocks on a semaphore.
@loicdescotte
loicdescotte / MixedTweets.md
Created August 5, 2012 17:59
How to push 2 mixed searches from twitter with Scala, Play2, Iteratee and Comet

##MixedTweets

We will see how to mix 2 twitter searches and push the results to the browser in real time.

First, checkout this mini project

To try it, you need to install Play 2.0

###Controller

@j4rs
j4rs / client.js
Created July 9, 2012 22:26
NodeJS GCM Server to send message to android devices...
var GCM = require('./gcm');
var gcm = new GCM(<YOUR GOOGLE API KEY>); // https://code.google.com/apis/console
// create the message
var msg = {
registration_ids: [token], // this is the device token (phone)
collapse_key: "your_collapse_key", // http://developer.android.com/guide/google/gcm/gcm.html#send-msg
time_to_live: 180, // just 30 minutes
data: {
@georgeredinger
georgeredinger / setup.md
Created June 23, 2012 23:14 — forked from leesmith/setup.md
Ruby on Rails development setup on Ubuntu 12.04 (vim, git, rbenv)

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev