Skip to content

Instantly share code, notes, and snippets.

View arjo129's full-sized avatar
💭
🦀

Arjo Chakravarty arjo129

💭
🦀
View GitHub Profile
@arjo129
arjo129 / robot_tf_tree.launch
Last active September 8, 2020 10:54
Launch file for NUSSEDS Autonomy x Rovers Software bootcamp
<launch>
<node pkg="tf" type="static_transform_publisher" name="baselink2camera" args="0 0 1.2 0 0 0 1 base_link camera_link 100" />
<node pkg="tf" type="static_transform_publisher" name="baselink2gripper" args="0.5 0 0.6 0 0 0 1 base_link gripper 100" />
<node pkg="rostopic" type="rostopic" name="apple_detector" args="pub /camera/detector/apple geometry_msgs/PointStamped &quot;{header:
{seq: 0,
stamp: {
secs: 0,
nsecs: 0},
frame_id: &apos;camera_link&apos;},
point:{
@arjo129
arjo129 / shuff.c
Last active June 14, 2020 07:21
A replacement for the coreutils `shuf` tool for huge files on disk with long (multi-GB) lines.
#define MAX_CAPACITY 10000
#define MIN_BUFFER 1000
#define MAX_LINE 10
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
long getRandomNumber(long max) {
return random()%max;
@arjo129
arjo129 / MockFile.py
Created February 25, 2019 13:52
A very simple class to conveniently emulate file operations in memory using python.
class MockFile:
def __init__(self):
self.data = []
self.position = 0
def seek(self, offset, type=0):
if type == SEEK_END:
self.position = len(self.data) - offset
else:
self.position = offset
@arjo129
arjo129 / chat.msg
Last active August 21, 2018 07:15 — forked from chewwt/chat.msg
std_msgs/Header header
std_msgs/String source_id
std_msgs/String message
@arjo129
arjo129 / mamama
Last active April 1, 2018 10:41
A very important shell utility
#!/bin/bash
# This is the most important shell utility... remember to place it in your PATH
# chmod +x mamama
echo "Ototototo"
import rospy
from sensor_msgs.msg import *
from cv_bridge import CvBridge
import cv2
import numpy as np
bridge = CvBridge()
rospy.init_node("Redmasker")
image_pub = rospy.Publisher("RedMasked",Image)
def img_handler(msg):
@arjo129
arjo129 / conjugation.py
Created December 10, 2017 10:55
Just the conjugation... It doesnt work correctly still
def conjugation(self, vector):
"""Conjugation of vector by self.
@param self unit quaternion.
@param vector 3-vector, aka pure quaternion.
@return pure quaternion of result: self *vector*self.
"""
self.x,self.y,self.z = self.v
Q = np.array([[self.w, -self.z, self.y, self.x],
[ self.z, self.w, -self.x, self.y],
[-self.y, self.x, self.w, self.z],
------------------------------- MODULE hanoi -------------------------------
EXTENDS Integers, Sequences
\* Towers of hanoi problem
VARIABLES tower1, tower2, tower3
\* Initiallize the towers
Init == /\ tower1 = <<3,2,1,0>>
/\ tower2 = <<0>>
/\ tower3 = <<0>>
\* Transition rules
@arjo129
arjo129 / debugUspeech
Created April 30, 2014 03:08
debug uspeech file from 4.1.1
#include <uspeech.h>
signal voice(A0);
char option = 0;
void setup(){
voice.calibrate();
voice.f_enabled = true;
Serial.begin(9600);
}
void loop(){
//voice.sample();
@arjo129
arjo129 / 2048.c
Last active August 29, 2015 13:58 — forked from justecorruptio/2048.c
A more readable version
M[16],X=16,W,k;
main(){
T(system("stty cbreak"));
puts(W&1?"WIN":"LOSE");
}
K[]={2,3,1};
s(f,d,i,j,l,P){
for(i=4;i--;){
for(j=k=l=0;k<4;){