Skip to content

Instantly share code, notes, and snippets.

View EricWiener's full-sized avatar

Eric Wiener EricWiener

View GitHub Profile
@chfritz
chfritz / use_robot.sh
Last active January 17, 2024 19:39
Simple script to setup your machine env to use a remote ROS master
#!/bin/bash
# Simple script to setup your machine env to use a remote ROS master
# example usage: use_robot.sh myrobot
# where myrobot is a resolvable hostname or an IP address
NORMAL=`tput sgr0 2> /dev/null`
GREEN=`tput setaf 2 2> /dev/null`
# get the IP of our device we'll use to conect to the host
@bhpfelix
bhpfelix / tf_vs_pt.py
Created June 25, 2019 10:52
Comparing TensorFlow and PyTorch Operation (AvgPool, Conv2d)
import numpy as np
np.random.seed(0)
import torch
import torch.nn as nn
import tensorflow as tf
import matplotlib.pyplot as plt
slim = tf.contrib.slim
@bayodesegun
bayodesegun / sos_service.py
Last active June 21, 2024 05:43
Sample ROS Service Server and Client
#! /usr/bin/env python
# remember to make this file executable (`chmod +x`) before trying to run it
import rospy
from std_srvs.srv import Trigger, TriggerResponse
def trigger_response(request):
return TriggerResponse(
success=True,
message="Hey, roger that; we'll be right there!"
@waylan
waylan / tempdir.py
Created May 24, 2018 20:27
A decorator for building a temporary directory with prepopulated files.
from functools import wraps
try:
# py>=3.2
from tempfile import TemporaryDirectory
except ImportError:
from backports.tempfile import TemporaryDirectory
from pathlib2 import Path
def tempdir(files=None, **kw):
"""
@hyb175
hyb175 / realmMock.js
Last active June 13, 2024 02:45
Realm Mock for jest
// https://github.com/realm/realm-js/issues/370#issuecomment-270849466
export default class Realm {
constructor(params) {
this.schema = {};
this.callbackList = [];
this.data = {};
this.schemaCallbackList = {};
params.schema.forEach((schema) => {
this.data[schema.name] = {};
});
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active June 16, 2024 11:03
React Native Bridging Cheatsheet
@n-st
n-st / .bash_profile
Created May 29, 2016 12:04
Start zsh from bashrc. Useful when you can't use chsh or when the same LDAP account is used both on systems with zsh installed and ones without.
# .bash_profile is executed for login shells,
# .bashrc is executed for interactive non-login shells.
# We want the same behaviour for both, so we source .bashrc from .bash_profile.
# Also, when .bash_profile exists, bash ignores .profile, so we have to source
# it explicitly.
if [ -f "$HOME/.profile" ]; then
. "$HOME/.profile"
fi
@squarism
squarism / iterm2.md
Last active June 26, 2024 08:10
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@Zearin
Zearin / python_decorator_guide.md
Last active June 5, 2024 20:26
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@ejdyksen
ejdyksen / patch-edid.md
Last active June 19, 2024 03:35
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):