Skip to content

Instantly share code, notes, and snippets.

Greg Malysa gmalysa

Block or report user

Report or block gmalysa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View client.c
#include <zmq.h>
int main(void) {
void *context = zmq_ctx_new();
void *sock = zmq_socket(context, ZMQ_REQ);
zmq_connect(sock, "tcp://localhost:5999");
gmalysa / steam-client.js
Created Apr 3, 2019
With node-dota2/node-steam, you need an updated list of steam login servers, because the server list that ships with node-steam is like 9 months out of date. Periodically should also rebuild this list.
View steam-client.js
const steam = require('steam');
const steamClient = new steam.SteamClient();
const steamUser = new steam.SteamUser(steamClient);
const dota2 = require('dota2');
const dotaClient = new dota2.Dota2Client(steamClient, true);
if (fs.existsSync('steam-servers.json')) {
steam.servers = JSON.parse(fs.readFileSync('steam-servers.json'));
View pdf.php
* Convert a series of TIFF files given on the command line to pages in
* a single PDF
if ($argc < 3) {
echo ('Convert a series of TIFF images as individual pages in a PDF');
echo ("\n".'Usage: php -f pdf_convert.php <output name> <input 1> <input 2> ...');
View list_ex.s
(defvar friends (evar friends '()))
(defvar enemies (evar enemies '()))
(defun start
(say "Halt, who goes there?")
(add-response "A friend." add-friend)
(add-response "An enemy." add-enemy))
(defun add-friend
(set-var! friends (cons (get-name character) friends))
View gist:3c4d87568ef995866f2d
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>)
function! s:RunShellCommand(cmdline)
echo a:cmdline
let expanded_cmdline = a:cmdline
for part in split(a:cmdline, ' ')
if part[0] =~ '\v[%#<]'
let expanded_part = fnameescape(expand(part))
let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '')
View gist:74743a96adb13be1298d
WELL = require('well-rng');
_ = require('underscore');
loop_count = 1000;
burn_count = 0;
s = [];
for (i = 0; i < 32; ++i) {
s[i] = 0;
gmalysa / opt_test.js
Last active Dec 20, 2015
Test of some simple function optimizations for javascript/nodejs.
View opt_test.js
// Test 1: Do simple functions get inlined?
var iter = 10000;
var start, stop;
function inc(a) { return a+1; }
// Wrap test in a function to allow warmup of optimizer
function test1_fn(iter) {
var x;
for (var i = 0; i < iter; ++i) {
gmalysa / gist:5581882
Last active Dec 17, 2015
Quick benchmark test for comparing flux-link to some standard async packages that are commonly used
View gist:5581882
Promise overhead (calling one after another) x1000:
1: 65ms Base (plain Node.js lstat call)
2: 75ms When: Dedicated wrapper
3: 86ms flux-link
4: 97ms Deferred: Dedicated wrapper
5: 102ms Deferred: Promisify (generic wrapper)
6: 135ms jQuery.Deferred: Dedicated wrapper
7: 1055ms Q: Dedicated wrapper
You can’t perform that action at this time.