Skip to content

Instantly share code, notes, and snippets.

View kuba--'s full-sized avatar
☮️
stop war

Kuba Podgórski kuba--

☮️
stop war
View GitHub Profile
@kuba--
kuba-- / pairing.go
Created April 7, 2019 00:39
Pairing Heaps
package heaps
// Elem is a comparable element of the heap
type Elem interface {
Compare(elem Elem) int
}
// PairingHeap is a type of heap data structure
type PairingHeap struct {
elem Elem
@kuba--
kuba-- / disjoint.go
Created April 7, 2019 00:44
Disjoint Sets
package sets
import (
"fmt"
"strings"
)
// DisjointSet tracks a set of elements partitioned
// into a number of disjoint (non-overlapping) subsets.
type DisjointSet struct {
@kuba--
kuba-- / m4a_to_mp3.sh
Last active January 24, 2024 17:55
Music files
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30; do find . -type f -name "${i}*" -print ; done > /tmp/files
cat /tmp/files | while read line || [[ -n $line ]]; do d=`dirname "${line}"`; b1=`basename "${line}"`; b2=`basename "${line}" | cut -c4-`; mv "${d}/${b1}" "${d}/${b2}"; done
find . -type f -name "*.m4a" -exec ffmpeg -v 5 -y -i '{}' -acodec libmp3lame -ac 2 -ab 192k '{}'.mp3 \; -print
@kuba--
kuba-- / exec.cpp
Created December 16, 2021 10:45
c++ exec system command
#include <cstdio>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include <array>
std::string exec(const char* cmd) {
std::array<char, 128> buffer;
std::string result;
@kuba--
kuba-- / KeyMapping.app
Created January 24, 2024 17:58
OSX Key Mapping
on run {input, parameters}
do shell script "hidutil property --set '{\"UserKeyMapping\":[{\"HIDKeyboardModifierMappingSrc\":0x700000064,\"HIDKeyboardModifierMappingDst\":0x700000035}]}'" with administrator privileges
return input
end run