Skip to content

Instantly share code, notes, and snippets.

@garaemon
garaemon / in1b.txt
Created October 13, 2022 22:39
IN1B error
[ERROR] [1665694767.726928] [/station_task:rosout]: Large diff detected 0.09167943382746951 > 0.0873: arm_link1_roll_j: -0.038
arm_link2_yaw_j: 0.024
arm_link3_roll_j: 0.013
arm_link4_yaw_j: 0.037
arm_link5_roll_j: -0.016
arm_link6_yaw_j: -0.068
arm_link7_roll_j: 0.003
function ssh-with-copy-id() {
ssh -o "PasswordAuthentication=no" $@
if [ $? != "0" ]; then
echo "Failed to ssh w/o password. Copy id_rsa.pub to the machine."
ssh-copy-id $@
ssh -o "PasswordAuthentication=no" $@
fi
}
@garaemon
garaemon / karabinar_slack_code.json
Last active February 14, 2021 01:49
Use command+e to create code region
{
"description": "Remap Command+e to Command+Shift+c in slack",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.tinyspeck\\.slackmacgap$"
],
"type": "frontmost_application_if"
@garaemon
garaemon / settings.json
Created April 25, 2020 10:22
C++ settings for customize-indentation-rules extension
"customizeIndentationRules.rules": [
{
"language": "cpp",
"increaseIndentationPattern": "^.*\\{[^}\"\\']*$|^.*\\([^\\)\"\\']*$|^\\s*(public|private|protected):\\s*$|^\\s*@(public|private|protected)\\s*$|^\\s*\\{\\}$",
"decreaseIndentationPattern": "^\\s*(\\s*/[*].*[*]/\\s*)*\\}|^\\s*(\\s*/[*].*[*]/\\s*)*\\)|^\\s*(public|private|protected):\\s*$|^\\s*@(public|private|protected)\\s*$"
}
]
(use-package gist :ensure t
:bind
(("C-c C-g" . gist-region-or-buffer))
)
(defun ros-catkin-make (dir)
"Run catkin_make command in DIR."
(interactive (list default-directory))
;; clear compilation buffer first not to occupy memory space.
(if (get-buffer "*catkin_make*")
(kill-buffer "*catkin_make*"))
(let* ((default-directory dir)
(compilation-buffer-name-function (lambda (major-mode-name) "*catkin_make*")))
(compile "catkin bt --no-status"))
(switch-to-buffer-other-window (get-buffer-create "*catkin_make*"))
@garaemon
garaemon / emacs-gc.el
Last active August 3, 2019 06:00
emacsのGCのしきい値を増やし, 入力がないときにGCを走らせる
;; Increase threshold to fire garbage collection
(setq gc-cons-threshold 1073741824)
(setq garbage-collection-messages t)
;; Run GC every 60 seconds if emacs is idle.
(run-with-idle-timer 60.0 t #'garbage-collect)
@garaemon
garaemon / wstool-chekcout-default.sh
Created March 8, 2019 01:40
Checkout default branch for all the repositories under catkin workspace
#!/bin/bash
wstool foreach "bash -c 'git symbolic-ref refs/remotes/origin/HEAD | sed s@^refs/remotes/origin/@@ | xargs git checkout'"
@garaemon
garaemon / helm-ros.el
Last active February 10, 2019 05:37
catkin packages helm source
(let ((cmake-prefix-path (getenv "CMAKE_PREFIX_PATH")))
(when cmake-prefix-path
(setq helm-source-catkin-root
(format "%s/../src" (car (split-string cmake-prefix-path ":"))))))
(defun helm-catkin-packages-list ()
(let ((string-output (shell-command-to-string (format "find %s -name package.xml -exec dirname {} \\\;" helm-source-catkin-root))))
(let ((dirs (split-string string-output "\n")))
dirs)))
@garaemon
garaemon / catkin.el
Created February 9, 2019 07:23
Run catkin build in emacs
;; Based on https://www.seas.upenn.edu/~chaoliu/2018/03/12/ros-programming-in-emacs/#org8817889
(require 'ansi-color)
(defun endless/colorize-compilation ()
"Colorize from `compilation-filter-start' to `point'."
(let ((inhibit-read-only t))
(ansi-color-apply-on-region
compilation-filter-start (point))))
(add-hook 'compilation-filter-hook
#'endless/colorize-compilation)