Skip to content

Instantly share code, notes, and snippets.

View patrislav1's full-sized avatar

Patrick Huesmann patrislav1

View GitHub Profile
@patrislav1
patrislav1 / keybase.md
Created September 22, 2019 11:01
keybase.md

Keybase proof

I hereby claim:

  • I am patrislav1 on github.
  • I am patrislav (https://keybase.io/patrislav) on keybase.
  • I have a public key ASC-I142cUuk51hhcnU0giycWfUr2ZWTaKd8WAYnI26KXAo

To claim this, I am signing this object:

@patrislav1
patrislav1 / avi-to-mkv.sh
Created September 11, 2021 14:57
Lossless conversion from .avi to .mkv (for Smart TV compatibility)
#!/bin/bash
FILES=$(find . -name "*.avi")
while read FILE; do
DESTFILE=$(echo ${FILE} | sed 's/\.avi$/\.mkv/g')
rm -f "${DESTFILE}"
ffmpeg -fflags +genpts -nostdin -i "${FILE}" -c:v copy -c:a copy "${DESTFILE}"
ls -lh "$FILE"
ls -lh "$DESTFILE"
done <<< $FILES
@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 / 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 / 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 / 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 / gist:97577dcd4b8743129dd72ec0fd16c4f0
Created February 5, 2024 16:00
Update author/committer email address in git history
git filter-branch --env-filter '
OLD_EMAIL="patrick.huesmann@desy.de"
NEW_EMAIL="info@patrick-huesmann.de"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
@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
@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 / 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