Skip to content

Instantly share code, notes, and snippets.

View protortyp's full-sized avatar
🚀

Christian Engel protortyp

🚀
  • Munich
  • 06:53 (UTC +02:00)
View GitHub Profile
@protortyp
protortyp / upload_time_in_days.py
Created June 15, 2023 16:38
Calculate the upload time in days, given upload speed in mbps, and terrabytes to upload
def upload_time_in_days(mbps, tb):
mbps_in_MBps = mbps / 8
tb_in_MB = tb * 1000000
total_seconds = tb_in_MB / mbps_in_MBps
total_days = total_seconds / (60 * 60 * 24)
return total_days
@protortyp
protortyp / Dockerfile
Last active June 5, 2023 06:01
Dockerfile for libtorch development on Apple Silicon
FROM --platform=linux/amd64 ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y curl unzip wget zsh \
libopenblas-dev \
libjpeg-dev \
libpng-dev \
build-essential \
# Wait for the transform to become available
listener.waitForTransform('/base_link', '/end_effector', rospy.Time(), rospy.Duration(4.0))
# Get the transformation matrix from the robot base to the end effector
(trans, rot) = listener.lookupTransform('/base_link', '/end_effector', rospy.Time(0))
rot_matrix = tf.transformations.quaternion_matrix(rot)
transformation_matrix = tf.transformations.concatenate_matrices(rot_matrix, tf.transformations.translation_matrix(trans))
import rospy
import tf
from geometry_msgs.msg import Quaternion
# Create a quaternion object
quat = Quaternion()
quat.x = 0.1
quat.y = 0.2
quat.z = 0.3
quat.w = 0.4
#!/usr/bin/env python
import rospy
import cv2
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from PyCapture2 import *
def image_publisher():
rospy.init_node('epiphan_image_publisher', anonymous=True)
pub = rospy.Publisher('image_topic', Image, queue_size=10)
@protortyp
protortyp / daily_note.md
Created March 5, 2023 10:17
Obsidian Daily Note Template

<%* let weekNumber = moment().format('W') let year = moment().format('Y') let month = tp.date.now("MM-MMMM") let yesterday = tp.date.now("YYYY-MM-DD_ddd", -1) let today = tp.date.now("YYYY-MM-DD_ddd") let tag = "#cw" + weekNumber + "_" + year let prevTag = #cw${weekNumber - 1}_${year} let file_path = A_daily_notes/${year}/${month}/${today} %>

@protortyp
protortyp / tum_ds_2022.md
Created February 8, 2023 20:34 — forked from bttger/tum_ds_2022.md
My mdfc notes I collected throughout the semester with copied stuff from slides, papers, and the internet. NOT REVIEWED YET answers might be wrong and please don't copy them blindly

Overview

Why should you make a distributed system?

  • The system is inherently distributed (e.g. mobile devices like smartphones)
  • Reliability (some nodes can fail and the system keeps functioning; fault tolerance)
  • Performance (process data faster by utilizing multiple nodes or achieve better latency by requesting data from a nearby node)
  • The capacity of a single machine isn’t enough for the task (e.g. limited memory size, bandwidth, CPU cycles, etc.; scalability)

What are the Characteristics of distributed systems?

@protortyp
protortyp / extract_by_sim.py
Last active December 31, 2022 14:09
Filter images that are similar to a template
"""
Copy all images that look similar to a template to a different location.
This script finds similar areas in source images, crops the target area, and
stores the result in a target directory.
"""
import concurrent.futures
import cv2
import os
import multiprocessing
@protortyp
protortyp / split_datasets.py
Created December 28, 2022 06:56
Split datasets into train,val,test subdirectories
"""
Splits a dataset of png images into train, val, and test sets.
Creates the folders and randomly chooses files.
"""
import os
import random
import argparse
try:
import termcolor
@protortyp
protortyp / .aliases
Last active October 5, 2020 18:56
aliases
alias bb='brave-browser'
alias t='tmux'
alias ta='tmux attach'
alias sagi='sudo apt-get install -y'
alias sagu='sudo apt-get update'
alias e='echo'
alias sl='exa'
#alias ls='exa'
alias sls='exa'
alias pwd='pwd -P'