Skip to content

Instantly share code, notes, and snippets.

View tsbertalan's full-sized avatar

Tom Bertalan tsbertalan

  • University of Massachusetts Lowell
  • United States
View GitHub Profile
try:
import scigma
except:
import traceback
traceback.print_exc()
print()
print("Could not import scigma.")
raw_input("Press enter to exit.")
@tsbertalan
tsbertalan / CMakeLists.txt
Last active February 12, 2017 16:40
beginner_totorials fails with undefined reference ros::init(...args...)
# %Tag(FULLTEXT)%
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)
## Generate added messages and services
#generate_messages(DEPENDENCIES std_msgs)
@tsbertalan
tsbertalan / CMakeLists.txt
Last active March 24, 2020 23:06
undefined reference to ros::init
cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)
## Find catkin and any catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg)
## Declare ROS messages and services
#add_message_files(DIRECTORY msg FILES Num.msg)
#add_service_files(DIRECTORY srv FILES AddTwoInts.srv)
@tsbertalan
tsbertalan / musicKeys.py
Last active August 29, 2015 14:02
music keys CLI
#!/usr/bin/env python
'''
A brittle little program that emits media keys on the :0 X11 display
when it gets certain input characters at the command line.
I use this for transforming my phone into a gestural remote control for my
Google Play Music on my desktop, using Server Auditor as an Android SSH client,
and this extension to listen for media key presses and send them to Google Play Music:
https://chrome.google.com/webstore/detail/key-socket-media-keys/fphfgdknbpakeedbaenojjdcdoajihik
.
'''
Quick hack to combine two BibTeX files with truly indentical entries
into one monolithic file.
Someone else could write an argparse interface to make this more reusable.
For now, I just need to get back to work.
'''
from bibtexparser.bparser import BibTexParser
with open('math.bib', 'r') as bibfile:
'''
Quick hack to combine two BibTeX files with truly indentical entries
into one monolithic file.
Someone else could write an argparse interface to make this more reusable.
For now, I just need to get back to work.
'''
from bibtexparser.bparser import BibTexParser
with open('math.bib', 'r') as bibfile:
@tsbertalan
tsbertalan / bouncr.py
Created January 13, 2014 01:24
bouncing ball
'''
This example uses a MovieWriter directly to grab individual frames and
write them to a file. This avoids any event loop integration, but has
the advantage of working with even the Agg backend. This is not recommended
for use in an interactive setting.
This version avoids the ugly stateful plt.* expressions, and the
set_data method. Instead, it uses the more generic axis methods. This is slower,
but easier to remember, I hope.
'''
import numpy as np
import scipy.linalg
n = 130
r = np.array(np.random.normal(size=(n, n)), dtype=np.float32)
e = scipy.linalg.eig(r, left=False, right=False)
print e.mean()
import numpy as np
import scipy.linalg
n = 130
r = np.array(np.random.normal(size=(n, n)), dtype=np.float32)
e = scipy.linalg.eig(r, left=False, right=False)
print e.mean()
@tsbertalan
tsbertalan / qsub.py
Created October 25, 2013 18:44 — forked from astrofrog/qsub.py
import os
import random
import string
import tempfile
import subprocess
def random_id(length=8):
return ''.join(random.sample(string.ascii_letters + string.digits, length))
TEMPLATE_SERIAL = """