Skip to content

Instantly share code, notes, and snippets.

View montyanderson's full-sized avatar

Monty Anderson montyanderson

View GitHub Profile
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@bellbind
bellbind / dh-usage.js
Created October 21, 2011 07:09
[nodejs][javascript] Diffie-Hellman key exchange by nodejs-0.5
// node.js 0.5 Diffie-Hellman example
var assert = require("assert");
var crypto = require("crypto");
// the prime is shared by everyone
var server = crypto.createDiffieHellman(512);
var prime = server.getPrime();
// sharing secret key on a pair
@bechu
bechu / boost_tcp_client.cpp
Created April 19, 2012 19:18
simple boost tcp client example
/*
g++ main.cpp -lboost_system -lboost_thread -lpthread -o main
*/
#include <boost/asio.hpp>
#include <boost/array.hpp>
#include <iostream>
void send_something(std::string host, int port, std::string message)
@companje
companje / Mandelbrot.pde
Created May 21, 2012 18:55
Mandelbrot visualization in Processing
// Interactive Mandelbrot Set
// Inspired by Daniel Shiffman's Processing example.
// by Rick Companje - www.companje.nl - 6 december 2009
double xmin = -2.5;
double ymin = -2;
double wh = 4;
double downX, downY, startX, startY, startWH;
int maxiterations = 200;
boolean shift=false;
@adammw
adammw / README.md
Created August 3, 2012 06:30
Node.js for Raspberry Pi

Node.js for Raspberry Pi

Pre-built binaries

Recent releases have been pre-built using cross-compilers and this script and are downloadable below.

If you have found these packages useful, give me a shout out on twitter: @adammw

@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@hmartiro
hmartiro / zeromq-vs-redis.md
Last active June 17, 2024 14:04
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

@Hidendra
Hidendra / redis-aggregate.lua
Last active December 5, 2019 02:33
Aggregate values in a redis sorted set. Returns {count, sum, min, max}
local result = redis.call('zrange', KEYS[1], 0, -1, 'withscores')
local count = 0
local sum = 0
local min = 0
local max = 0
for i=1, #result, 2 do
local score = result[i + 1]
@nielin
nielin / social.js
Last active August 29, 2015 14:16 — forked from rampicos/social.js
function hex_sha1(s) {
return binb2hex(core_sha1(str2binb(s), s.length * chrsz));
}
function b64_sha1(s) {
return binb2b64(core_sha1(str2binb(s), s.length * chrsz));
}
function str_sha1(s) {
return binb2str(core_sha1(str2binb(s), s.length * chrsz));
#include <microhttpd.h>
#define PORT 8888
int answer_to_connection (void *cls, struct MHD_Connection *connection,
const char *url,
const char *method, const char *version,
const char *upload_data,
size_t *upload_data_size, void **con_cls)
{