Skip to content

Instantly share code, notes, and snippets.

View scottlawsonbc's full-sized avatar

Scott Lawson scottlawsonbc

  • Vancouver, Canada
View GitHub Profile
@JosephPecoraro
JosephPecoraro / shell-execution.rb
Last active September 10, 2023 10:12
Shell Execution in Ruby
# Ways to execute a shell script in Ruby
# Example Script - Joseph Pecoraro
cmd = "echo 'hi'" # Sample string that can be used
# 1. Kernel#` - commonly called backticks - `cmd`
# This is like many other languages, including bash, PHP, and Perl
# Synchronous (blocking)
# Returns the output of the shell command
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111
@bamthomas
bamthomas / pub_sub_redis.py
Created November 28, 2012 22:16
Pub/Sub redis python
from multiprocessing.process import Process
import time
import redis
def pub(myredis):
for n in range(10):
myredis.publish('channel','blah %d' % n)
time.sleep(5)
def sub(myredis, name):
@mikofski
mikofski / metapoop.py
Last active October 22, 2022 12:21
Another Python metaclass primer
#! /usr/bin/env python
"""
Python metaclasses
==================
A metaclass is a class factory; metaclasses serve two purposes:
1. replace ``type`` as the base class metatype for classes with the
``__metaclass__`` attribute
@debasishg
debasishg / gist:8172796
Last active July 5, 2024 11:53
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@apeckham
apeckham / test_spec.rb
Created May 1, 2014 21:56
passing callables to shared examples in rspec
require 'spec_helper'
shared_examples_for 'shared examples with proc' do |param1, param2|
it do
expect(param1).to eq param2.call
end
end
def true_method
true
@lanius
lanius / reconstruct.py
Last active December 13, 2023 00:59
3D reconstruction from stereo images in Python
# -*- coding: utf-8 -*-
import argparse
import cv2
import numpy as np
def calc_disparity(left_image, right_image):
window_size = 3
@husobee
husobee / scanval.go
Last active December 16, 2022 18:44
scanner valuer example
package main
import (
"database/sql"
"database/sql/driver"
"errors"
"fmt"
_ "github.com/mattn/go-sqlite3"
)
@josyb
josyb / test_xx.py
Created September 8, 2015 19:10
A MyHDL test_ template for Eclipse
'''
Created on ${date}
@author: ${user}
'''
from __future__ import print_function
# optional import to mark 'xfail' tests
import py.test
@HokieGeek
HokieGeek / buspirate-bulkrom.py
Last active January 17, 2021 12:47
Trying out bus pirate binary mode in python and haskell
#!/usr/bin/python
import serial
import signal
import sys
import time
def BinaryModeEnter(connection):
connection.flushInput()
for x in range(0, 20): # Try at most 20 times
@hansihe
hansihe / rl-api.md
Last active October 19, 2022 21:54
Rocket League API Documentation

#Rocket League API

Endpoints

All requests seem to be to the domain https://psyonix-rl.appspot.com. There are several endpoints on this domain.

Endpoint Purpose
/callproc105/ Leaderboard, player statistics
/Population/GetPopulation/ Player counts/regions
/login105/ Authentication, obtaining session ids