Skip to content

Instantly share code, notes, and snippets.

View cubapp's full-sized avatar

Jakub Urbanec cubapp

View GitHub Profile
@cubapp
cubapp / balda074.c
Last active October 14, 2026 08:38
balda074.c
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
void main(void) {
short life = (short)0x3C;
uint8_t vek = UINT8_C(074);
printf("Life is short but věk je jen číslo\n");
printf("life = %hd, vek = %" PRIu8 "\n", life, vek);
}
@cubapp
cubapp / HowToConcatenatePDFonMAC.md
Created October 13, 2026 09:41
Concatenate multiple PDF files in MacOS X 15.x

You have first.pdf second.pdf last.pdf files to concatenate.

  1. Open each PDF in Preview.app, go to View-> Thumbnails and remove unwanted pages by selecting the pages you do not want, (with shift or command to select multiple), then save it (Cmd-S) to have exactly the PDF source you need.

  2. Run Automator join script in the terminal:

"/System/Library/Automator/Combine PDF Pages.action/Contents/MacOS/join" -o joined.pdf first.pdf second.pdf last.pdf
@cubapp
cubapp / JakZabezpečitPočitačMobilWiFi-2026.md
Last active September 24, 2026 17:27
Zabezpečení počítače, mobilu a WiFi - 2026.md

Zabezpečení zařízení pro seniora – checklist (2026)

Cíl: Maximálně snížit riziko podvodů, malwaru a nechtěných nákupů při zachování použitelnosti pro laika.

Vstup: počítač seniora, starší PC s Windows, starší Android. Rady:

  • dejte dědovi Mac nebo nainstalujte Linux
  • dědovi dejte přístup jen k seznam.cz na WiFi routeru
  • pusťte dědu jen na lokální kopii Wikipedi

prosím nepotřebujeme. Chceme pomoc zabezpečit - alespoň tak, jak je to možné - stroj seniora tak, aby byl alespoň trošku bezpečnější. (ok, vím, že to může znít jako oxymoron)

@cubapp
cubapp / gist:10b810800c8f45edeb941de4f0dc18ef
Created August 4, 2025 13:23
Mac OS X Automator for showing SHA sums in the Finder Menu Quick Actions
# in Automator go for New - Quick Action
# Run Shell Script, Workflow receives current: "files or folders" in "Finder.app"
# shell Pass Input: As Arguments
# then the automation will be present in Finder right click Quick Actions
for f in "$@"
do
hash=$(shasum -a 256 "$f" | awk '{print $1}' | fold -w32)
button=$(osascript -e "display dialog \"File: $f\n\nSHA256:\n$hash\n\n\" with title \"SHA256 Hash\" buttons {\"Copy to clipboard\", \"OK\"} default button 2")
if [[ $button == *"Copy"* ]]; then
@cubapp
cubapp / tools.txt
Created September 30, 2024 16:16
My tools with links
tmux, vim, rg (ripGrep/Silver Searcher/grep)
Honeypot Glutton (for samples) see https://github.com/mushorg/glutton
Shell aliases (tm,lt,mkcd) see https://github.com/cubapp/dotfiles
UPX (source!) see https://github.com/upx
CyberChef see https://github.com/gchq/CyberChef
binary refinery see https://github.com/binref/refinery
tlsh, vbindiff see https://github.com/trendmicro/tlsh
see https://github.com/madsen/vbindiff
hexedit
@cubapp
cubapp / HomeAssistant-ESP-Home-ePaper.yaml
Created July 9, 2024 13:49
ESP32 with small eInk to display data from HomeAssistant
esphome:
name: esphome-eink-01
on_boot:
priority: 700
then:
- delay: 3sec
- component.update: my_display
- delay: 200ms
- component.update: my_display
- delay: 200ms
@cubapp
cubapp / benchmark-hash.py
Created June 6, 2024 17:24
Benchmarking python script, taken from PHP version via https://3v4l.org/rMd8D
import time
import random
import string
import bcrypt
import hashlib
# Function to generate random string
def get_random_string(chars, length):
return ''.join(random.choice(chars) for _ in range(length))
@cubapp
cubapp / REST API to sunnymap.net via Home Assistant
Created May 4, 2023 07:12
Home Assistant REST to sunnymap.net using GoodWe
# How to add your FVE (PhotoVoltaicPlant) to the sunnymap.net with:
# * HomeAssistant
# * REST API
# * GoodWe integration
#
# First: register your FVE and get API key via: https://sunnymap.net/token_request
# Second: edit the files: configuration.yaml, automations.yaml
# Third: in Developers Tools (/developer-tools/yaml):
# - check the configuration
# - restart configuration
@cubapp
cubapp / rename-files-in-subdirs.sh
Last active October 14, 2020 20:10
Rename files in subdirectories according to the directory name. Dirty - files with spaces does not work (grrrr)
for i in $(ls -1); { echo $i; (cd $i; for ff in * ; { aa=$((aa+1)) ; mv "$ff" ${i}-${aa}.jpg } ) }
@cubapp
cubapp / dobble.c
Last active September 23, 2020 05:25
Dobble game card generator.
#include <stdio.h>
#include <stdlib.h>
// Dobblo generator
// Here is a C code inspired from @karinka's answer with a different arrangement of symbols.
// https://math.stackexchange.com/questions/1303497/what-is-the-algorithm-to-generate-the-cards-in-the-game-dobble-known-as-spo
//
// It works for n being a prime number (2, 3, 5, 7, 11, 13, 17, ...).
//
// Number of symbols in a given card = n+1
// Total number of cards = n^2 + n + 1