Skip to content

Instantly share code, notes, and snippets.

View patrislav1's full-sized avatar

Patrick Huesmann patrislav1

View GitHub Profile
@patrislav1
patrislav1 / https-ssh.sh
Created September 12, 2024 07:32
git remote https to ssh
for remote in $(git remote); do
oldurl=$(git remote get-url $remote);
newurl=$(echo $oldurl | sed 's?^https://?git@?' | sed 's?/?:?').git;
echo $remote: $oldurl -\> $newurl;
git remote set-url $remote $newurl;
done
@patrislav1
patrislav1 / go-mod-to-bitbake.py
Created April 5, 2024 13:23
go.mod to static bitbake recipe
#!/usr/bin/env python3
import re
import sys
import subprocess
def get_commit_hash(repo_url, version_tag):
command = ["git", "ls-remote", "--tags", "--refs", repo_url]
result = subprocess.run(command, capture_output=True, text=True)
@patrislav1
patrislav1 / save-zoom-recording.md
Last active September 30, 2024 06:22
Save video file of a Zoom recording

Save zoom recording with a bookmarklet

  1. Create bookmarklet

Add bookmark with this URL:

javascript: (() => { vid = document.querySelector('.vjs-tech'); console.log(vid.src); window.open(vid.src, '_blank'); })();
  1. Open Zoom recording link
  2. Click on the bookmark
@patrislav1
patrislav1 / gist:97577dcd4b8743129dd72ec0fd16c4f0
Created February 5, 2024 16:00
Update author/committer email address in git history
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
NEW_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
@patrislav1
patrislav1 / ikea-rodret_E2201_ZHA-Z2M_control-light.yaml
Last active October 19, 2024 22:03 — forked from damru/ikea-rodret_E2201_ZHA-Z2M_control-light.yaml
IKEA RODRET Dimmer Remote (E2201) - ZHA/Z2M - Control Light
blueprint:
name: IKEA Rodret Dimmer Light Control (ZHA/Z2M)
description: "## Control Light with IKEA RODRET Dimmer remote (v1.0)
Only for use with [ZHA](https://www.home-assistant.io/integrations/zha/)
or Zigbee2MQTT (cf [MQTT](https://www.home-assistant.io/integrations/mqtt)
+ [Z2M addon](https://www.zigbee2mqtt.io/guide/installation/03_ha_addon.html)).
@patrislav1
patrislav1 / simple-factory.cpp
Created November 13, 2022 13:05
Simple factory
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <string>
struct Base {
virtual std::string blub() = 0;
};
@patrislav1
patrislav1 / gitlab_tree.py
Created February 18, 2022 17:40
Show GitLab project tree as markdown
#!/usr/bin/env python3
import requests
import sys
from sortedcontainers import SortedDict, SortedList
class GitlabApi:
API_LINK = 'api/v4'
@patrislav1
patrislav1 / miniprof.hpp
Last active January 31, 2022 17:06
miniprofiler
#pragma once
#include <chrono>
#include <string>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
namespace blg = boost::log::trivial;
@patrislav1
patrislav1 / terminal.html
Created January 28, 2022 16:37
HTML template for terminal clipboard ('Copy as HTML') copy
<pre style="background-color: #0f0800;color: #bbbbbb;">
...insert copied message here...
</pre>
@patrislav1
patrislav1 / .clang-format
Last active April 2, 2024 09:08
clang-format configuration
---
BasedOnStyle: Chromium
IndentWidth: 4
IncludeCategories:
- Regex: '<[a-zA-Z0-9_]+>' # standard headers (no extension)
Priority: 2
- Regex: '<[a-zA-Z0-9/]+\.(h|hpp)>' # library headers (with extension)
Priority: 3