Skip to content

Instantly share code, notes, and snippets.

@SebastianGrans
SebastianGrans / sp
Last active March 1, 2016 11:29 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@SebastianGrans
SebastianGrans / clock.sh
Created May 17, 2016 13:26
Bash script that gives you a running clock in the terminal
#!/bin/bash
# The clock function I got from here:
# http://www.linuxandlife.com/2012/08/how-to-create-continuous-digital-clock.html
#
# And then I wanted a script that would terminate on 'any key'
# http://stackoverflow.com/questions/5297638/bash-how-to-end-infinite-loop-with-any-key-pressed
#
if [ -t 0 ]; then stty -echo -icanon -icrnl time 0 min 0; fi
@SebastianGrans
SebastianGrans / when_shall_I_be_free-outro_tab.txt
Created April 12, 2017 11:11
When shall I be free? - Outro tab
e|--------------------------------|
B|--------------------------------|
G|--------------------------------|
D|--5h7---------------------------|
A|------7---5h7-------------------|
E|--------------8--7h8---5--------|
#
# I sometimes browse reddit with my browser split to half of the screen.
# By default, the side bar (submit new link, submit a new text post, etc.) covers
# half the page. I remedied this by injecting my own CSS with the following extension.
# https://safari-extensions.apple.com/details/?id=com.sobolev.stylish-5555L95H45
#
# Below is the exported style in JSON.
# Copy it to a file, save it as file.json, import in stylish. Should be good to go!
@SebastianGrans
SebastianGrans / Makefile
Last active March 6, 2018 12:18 — forked from jlintz/gist:1192247
Useful C debug macro.
DEBUG := n
CFLAGS := -std=gnu99 -Werror -Wall -Wno-deprecated-declarations
ifeq ($(DEBUG),y)
CFLAGS += -DDEBUG -g
endif
.PHONY: all clean
@SebastianGrans
SebastianGrans / redirect-to-wikiwand-with-adguard.txt
Last active June 22, 2023 11:12
Emulate the behaviour of the Wikiwand extension in Safari 13 using an AdGuard JavaScript filter
# Since Safari 13 the Wikiwand plugin is no longer available and they
# don't even list Safari as a supported browser anymore.
#
# Most people use some kind of ad blocker, and personally I'm using "AdGuard for Safari" which allows you
# to define filters that inject javascript code on certain domains.
#
# Simply add this to AdGuards "User filter", and any wikipedia article will be redirected to Wikiwand.
#
@@||wikipedia.org^$generichide,badfilter
@SebastianGrans
SebastianGrans / pcd_subscriber_node.py
Created July 27, 2020 16:29
ROS2 Node that subscribes to PointCloud2 messages and visualizes them using Open3D.
import sys
import os
import rclpy
from rclpy.node import Node
import sensor_msgs.msg as sensor_msgs
import numpy as np
import open3d as o3d
@SebastianGrans
SebastianGrans / point_cloud2.md
Last active March 28, 2023 10:33
ROS2 port of the `point_cloud2.py` script from ROS1.

In ROS1 there was a script called point_cloud2.py that was accessible as a module in the sensor_msgs package. I.e. by running from sensor_msgs import point_cloud2. It provided various functions for creating PointCloud2 messages from lists, and vice versa.

I have "ported" it to ROS2 and submitted a PR, but it is currently under review: ros2/common_interfaces#128

I've decided to also place it here to make it more visible and accessible (if the google search algorithms work).

@SebastianGrans
SebastianGrans / debayer_with_torch.py
Created September 30, 2021 16:08
Debayering a BayerRG (RGGB) image using PyTorch
# This only works for BayerRG color filter arrays. I.e. RGGB
# Inspired by this: https://github.com/cheind/pytorch-debayer
#
# I just wanted a minimal implementation to understand it better.
#
import torch
import numpy as np
import matplotlib.pyplot as plt
@SebastianGrans
SebastianGrans / keygen.py
Created November 3, 2021 10:42
Keygen for VS Code extension Monokai Pro
#
# This is a key generator for the VS Code/Codium extension Monokai Pro
# https://marketplace.visualstudio.com/items?itemName=monokai.theme-monokai-pro-vscode
#
# If you like the extension, you should buy it.
#
# 1. Run this script. It will ask for your email (it doesn't have to be real)
# 2. Run `> Monokai Pro: enter license` from the command palette (ctrl+shift+p)
# 3. Enter the same email as in step 1, followed by the generated key.
# 4. DONE! :)