Skip to content

Instantly share code, notes, and snippets.

View MrOneTwo's full-sized avatar

Michał Ciesielski MrOneTwo

  • Voi
  • Gothenburg SWEDEN
View GitHub Profile
#!/bin/bash
while $HOME/bin/clipnotify/clipnotify -s clipboard;
do
# selected_text="$(xsel)"
copied_text="$(xsel -b)"
# if [[ $selected_text != *"file:///"* ]]; then
# modified_text_primary="$(echo "$selected_text" | tr -s '\n' ' ')"
# echo -n "$modified_text_primary" | xsel -i
# fi
@MrOneTwo
MrOneTwo / tbot.py
Last active August 12, 2024 02:41
telegram ledger bot
import telegram.ext as telx
import telegram as tel
import logging
from datetime import date as dt
from pathlib import Path
from shutil import copyfile
"""
Functionallity for Telegram bot that drops ledger entries.
@MrOneTwo
MrOneTwo / dev.sh
Last active December 4, 2023 13:25
#!/usr/bin/env bash
txt_files=`fd --type file -g '*.txt' -E blinky`
c_files=`fd --type file -g '*.c' -E blinky`
echo $c_files $txt_files
# Set project specific build command.
kak -s a $c_files -e "set-option global makecmd 'ninja -C build-firmware'"
if [ $? != 0 ]; then
kak -c a $c_files -e "set-option global makecmd 'ninja -C build-firmware'"
@MrOneTwo
MrOneTwo / graph.py
Created December 2, 2022 15:01
A simple script that graphs C header dependencies, using graphviz
import sys
import glob
import re
from pathlib import Path
# https://github.com/xflr6/graphviz
import graphviz
DIR = sys.argv[1]
# get chat ID
curl https://api.telegram.org/bot(pass tokens/telegram/my_bot)/getUpdates | jq .result[].message.chat
# send message. 'chat_id' taken from previous step
curl -X POST \
-H 'Content-Type: application/json' \
-d '{"chat_id": "486714429", "text": "test message from curl", "disable_notification": true}' \
https://api.telegram.org/bot(pass tokens/telegram/my_bot)/sendMessage
@MrOneTwo
MrOneTwo / esp32_wrover.scad
Created November 4, 2021 14:17
Generate a ESP32 WROVER module 3D model using OpenSCAD
// ESP32 WROVER
module copy_mirror(vec=[0,1,0])
{
children();
mirror(vec) children();
}
$fs = 0.3;
@MrOneTwo
MrOneTwo / pcb.scad
Last active November 3, 2021 16:27
Generate a PCB in OpenSCAD
// Generate a simple PCB with mounting holes in the corners
module copy_mirror(vec=[0,1,0])
{
children();
mirror(vec) children();
}
module rounded_box(width, length, height, radius){
hull(){
@MrOneTwo
MrOneTwo / update_tags.sh
Last active December 5, 2024 10:20
Updating tags for a C project
ctags -R --exclude=*.js --exclude=*.pxd --exclude=*.html --exclude=build/* .
# alternative
#find ./my_project ./zephyr -type f -iname '*.c' -o -iname '*.h' | ctags -L -