Skip to content

Instantly share code, notes, and snippets.

View ptsurko's full-sized avatar
🎯
Focusing

PT ptsurko

🎯
Focusing
View GitHub Profile
@ptsurko
ptsurko / gist:a64f980fed8ad433f10eccf64f1cfad9
Created February 7, 2020 18:03
Read rosbag from s3 bucket
import rosbag
import rospy
import s3fs
fs = s3fs.S3FileSystem(key="<access_key>", secret="<secret_key>")
with fs.open('<bag>/<key>', 'rb') as f:
print('opened file')
bag = rosbag.Bag(f, mode='r', allow_unindexed=True, skip_index=True)
print('opened bag')
print('version: ', bag.version)
@ptsurko
ptsurko / bazel.md
Last active March 22, 2016 06:49
Create homebrew formula

Create homebrew formula

Create formula file for installation package

brew create https://github.com/bazelbuild/bazel/archive/0.2.0.tar.gz --no-fetch

This will create formula file in /usr/local/Library/Formula/<formula_name>.rb

Update formula file with installation instructions

@ptsurko
ptsurko / README.md
Last active March 11, 2016 20:06
Github pages autodeploy using Travis CI
@ptsurko
ptsurko / auto-deploy.md
Last active August 3, 2016 22:50 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@ptsurko
ptsurko / descriptors.py
Created April 19, 2015 10:27
Python descriptors
class classmethod(object):
def __init__(self, func):
self.func = func
def __get__(self, instance, klass):
if klass is None:
klass = type(instance)
def newfunc(*args, **kwargs):
return self.func(klass, *args, **kwargs)
using System;
using System.Collections.Generic;
namespace TwitterTest
{
public class Solver
{
private readonly int[] _walls;
@ptsurko
ptsurko / gist:6098118
Last active December 20, 2015 08:09
JavaScript - accessing private variables in prototype methods
var Animal = (function() {
var heartRate; //private variable available in prototype functions
function Animal() {
heartRate = 90;
console.log('heart rate: ' + heartRate);
};
Animal.prototype = {
constructor: Animal,
doDance: function() {
heartRate = 120;