Skip to content

Instantly share code, notes, and snippets.

@xaedes
xaedes / factorio item box message signaling sender blueprint.txt
Created October 6, 2020 09:05
factorio item box message signaling sender blueprint
0eNrtXG2P2jgQ/i/5emEVO7aToGulVvetLyfdqVKlU4Wy4N21CglKQnXbiv9+CexCSGwyY7JAVvelKgtMnOeZ95nwy7mdr+QyU0nhjH85apomuTP+55eTq/sknld/Kx6X0hk7qpALx3WSeFG9KrI4yZdpVoxu5bxw1q6jkpn81xmTtdv55ThTxcNCFmo6mqaLW5XERZrVZND1N9eRSaEKJben2bx4nCSrxa3MyovsROWr27yIC5UmpfhlmqvNf8sLl2JGxHOdR2cc0XV1qIYMupexiOfz0TxeLHUy2A1/knLDyyOWABVZOp/cyof4hyqPXX5uqrLpShWT8r3Z7st3KsuLSQuJHyorVuVf9lfffGI0fZDT7872AuUdVXR41YvFMs428Iydt856+34ip9VV8kosqf65z6RM6kCpmTP23d3BqpclqGsdDn4HLRpI/DogM5Vtj+OMhR6evdw9QrkFRB8reHJZyYB/qVLv6nvpUmZbPRk77z7/UX4uXRXLFZ4hEweZnDUZYKRJgXvwvhBtilyHGqQRdvhpUlmJlnkT1Wx3S89K1kG096z7PpDqOzUvZGbwICZgv27VflXpPKk5km8YbSeihY4WA25yYe3bD813rxEs4IIDlOAALligBIcwD8gOhQ7HAVKgB4yAkWCHLn9RIGZp0SsMhMBgqKIlDgc2LBwoEId9djGTUzWTWYeXPNCKms1RPTZPQk+Lhe9sYuH7LZ41CH+3iIM7XpaPk43Xntxl6WKiklKKM76L57k8iRfSiJIVvseiKA3bnv8pimqvFzXl+7DIQaidXrAB6sXba9ALguOVeE1iGZBY+xQYavN9pcC7IIml+Imc07PgjSBEDgzPWnVx6hjf1DPxyaz5ZP/z2cGnf9wZa5ypCw/HR807MtHN8XQTg/n2VMEetjuWSmZTldyPstIrzvLRIr6Pf6pE1ng/SHLqpP5mQek7M6F6Q+r0rKQjQgtgZiWsmWJn7jXIePrwUvy8R/LDuujhQPj3laRKcpmVlfqxqre
@xaedes
xaedes / iss_spacex_dragon_docking.js
Created May 21, 2020 17:47
SpaceX Dragon simulator autopilot docking on ISS
// go to https://iss-sim.spacex.com/
// open browser console and paste this document to enable autopilot
// to disable autopilot:
// clearInterval(a);
let a = setInterval(() => {
// retrieve values from simulation
let roll = fixedRotationZ;
let pitch = fixedRotationX;
let yaw = fixedRotationY;
let rpy = new THREE.Vector3(roll, pitch, yaw);
@xaedes
xaedes / get-data-covid19-germany.py
Created March 29, 2020 16:32
Python Dataimport of Corona COVID-19 Infected and Dead Counts for Germany from Wikidata
import requests
import pandas as pd
import datetime
url = 'https://query.wikidata.org/sparql'
query_infected = """
SELECT ?infectedDate ?infectedValue
WHERE
{
wd:Q83889294 p:P1603 ?infectedItem.
?infectedItem ps:P1603 ?infectedValue.
@xaedes
xaedes / GenericVec.hpp
Last active February 14, 2020 18:40
C++ Header Only Type Generic Vector Implementation (can be used as replacement for cv::Vec to avoid heavy dependency on OpenCV when you just need basic vector artihmetic)
#pragma once
#define ARITHMETIC_OPERATOR(OP) \
Vec<TValueType,TNumDimensions>& operator OP ## =(const Vec<TValueType,TNumDimensions>& rhs) \
{ \
for(unsigned int i=0; i<TNumDimensions; ++i) \
*this[i] OP ## = rhs[i]; \
return *this; \
} \
\
@xaedes
xaedes / pub_seq.py
Created December 10, 2019 13:07
Publish ROS message with seq number as specified in message in Python / Rospy
def pub(publisher, msg):
# undocumented rospy behaviour:
# publisher.publish will pre-inc publisher.impl.seq
# and use this instead of msg.header.seq
# (see https://github.com/ros/ros_comm/blob/309753f4777755f1dc9482f26fbeeeceb48f352d/clients/rospy/src/rospy/topics.py#L1065)
publisher.impl.seq = msg.header.seq - 1
publisher.publish(msg)
@xaedes
xaedes / sympy_to_numba.py
Last active October 21, 2019 15:03
Generate python code with numba jit from sympy array expression
import sympy
import re
import numba
import numpy as np
def sympy_rot_x(angle):
cs, sn = sympy.cos(angle), sympy.sin(angle)
return np.array([
[1,0,0,0],
[0,cs,-sn,0],
@xaedes
xaedes / convert_pdfs_to_text.sh
Created October 2, 2019 13:20
simple script to convert folder of pdfs to text in bash using pdftotext
#!/bin/bash
CONVERT=pdftotext
OUTPUT_FOLDER="text"
CONVERT_FLAGS1=
CONVERT_FLAGS2=-layout
VARIANT_FOLDER1="${OUTPUT_FOLDER}/plain"
VARIANT_FOLDER2="${OUTPUT_FOLDER}/layout"
@xaedes
xaedes / gist:91580427d19b12d41e77b80acd0142c6
Created June 5, 2019 13:28
jupyterlab move cells with keyboard
{
// Move cell up
"notebook:move-cell-up": {
"selector": ".jp-Notebook:focus",
"command": "notebook:move-cell-up",
"keys": [
"Ctrl ArrowUp"
]
},
@xaedes
xaedes / gist:97311911b981231ffd5a0084e0a47ede
Created June 5, 2019 12:37
sublime text legacy eiffel colorschene
{
"color_scheme": "Packages/Color Scheme - Legacy/Eiffel.tmTheme"
}
@xaedes
xaedes / GenerateDependency.cmake
Created September 6, 2018 15:34
generate dependency by trying different styles
function(generate_dependency TargetName Dependency)
if(TARGET ${Dependency})
# Dependency is proper cmake library
target_link_libraries(${TargetName} ${Dependency})
else()
# Dependency is just name of library
if(DEFINED ${Dependency}_LIBRARIES)
target_link_libraries(${TargetName} ${${Dependency}_LIBRARIES})
elseif(DEFINED ${Dependency}_LIBS)