Skip to content

Instantly share code, notes, and snippets.

@g00ntar
g00ntar / make-text.sh
Created September 27, 2024 08:48
Bash Test for non-zero length string
#!/bin/bash
# by Dennis Williamson
# 2010-10-06, revised 2010-11-10
# for http://stackoverflow.com/q/3869072
# designed to fit an 80 character terminal
dw=5 # description column width
w=6 # table column width
t () { printf '%-*s' "$w" " true"; }
@g00ntar
g00ntar / byobu-keymappings.itermkeymap.json
Last active May 14, 2023 19:00
iTerm2 Byobu keymappings
{
"Key Mappings": {
"0xf70b-0x40000": { "Text": "[19;5~", "Action": 10 },
"0xf702-0x280000": { "Text": "[1;3D", "Action": 10 },
"0xf70d-0x20000": { "Action": 10, "Text": "[21;2~" },
"0xf706-0x40000": { "Text": "[1;5R", "Action": 10 },
"0xf701-0x280000": { "Text": "[1;3B", "Action": 10 },
"0x33-0x40000": { "Action": 11, "Text": "0x1b" },
"0xf703-0x260000": { "Action": 10, "Text": "[1;6C" },
"0xf729-0x20000": { "Action": 10, "Text": "[1;2H" },
@g00ntar
g00ntar / qemu.sh
Created April 5, 2023 16:46
Run x86 guest on ARM64 host
qemu-system-x86_64 -smp 4 -m 20G -nographic -M pc-q35-jammy --accel tcg \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=flash1.img \
-drive file=ubuntu-22.04-minimal-cloudimg-amd64.qcow2,format=qcow2,id=drive0,if=none \
-device virtio-blk,drive=drive0 \
-device virtio-net,netdev=network0 \
-netdev tap,id=network0,ifname=tap0,script=no,downscript=no,vhost=on
@g00ntar
g00ntar / gontar_macos_windows_shortcuts.json
Last active February 6, 2023 18:27
Windows shortcuts on macOS
{
"title": "Gontars Windows shortcuts on macOS",
"rules": [
{
"description": "Ctrl+C, Ctrl+V, Ctrl+X => Cmd+C (Copy), Cmd+V (Paste), Cmd+X (Cut)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "c",
@g00ntar
g00ntar / script.sh
Created August 31, 2022 18:17
ELK in docker
# These 2 commands should be executed on my host machine with IP 192.168.0.24
docker network create somenetwork
docker run -d --name elasticsearch --net somenetwork -p 9200:9200 -p 9300:9300 --name elasticsearch \
-e "discovery.seed_hosts=192.168.0.25,192.168.0.26,192.168.0.27,192.168.0.28" \
-e "node.name=es01" \
-e "cluster.initial_master_nodes=es01,es02,es03,es04,es05" \
-e "network.publish_host=192.168.0.24" \
docker.elastic.co/elasticsearch/elasticsearch:7.8.0
qemu-system-x86_64 -cpu host -smp 4 -enable-kvm -m 10240 -hda /dev/nvme0n1 -hdb /dev/nvme1n1 -boot d -vnc :0 -serial stdio
# This is a default config file for bottom. All of the settings are commented
# out by default; if you wish to change them uncomment and modify as you see
# fit.
# This group of options represents a command-line flag/option. Flags explicitly
# added when running (ie: btm -a) will override this config file if an option
# is also set here.
[flags]
# Whether to hide the average cpu entry.
@g00ntar
g00ntar / downloadVideoBlob.js
Created February 16, 2021 20:19
Download Video Blob
window.video = 1
window.chapter = 3
var options = {
"headers": {
"accept": "*/*",
"accept-language": "en-GB,en;q=0.9",
"range": "bytes=0-",
"sec-fetch-dest": "video",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site"
@g00ntar
g00ntar / filter.fish
Created October 13, 2020 18:27
get magento module paths
for E in *
if test -d $E
if string match -q -v '*theme*' $E > /dev/null
string trim (cat $E/registration.php | grep 'MODULE' -A1 | grep -v 'MODULE') | tr -d '"' | tr -d "," | tr -d "'" | tr "_" "/"
end
end
end
@g00ntar
g00ntar / capture_response.js
Last active May 28, 2020 11:03
Add callback to all XHRs
const DEVPLANS_URL = 'https://sip.lex.pl/api/developmentPlans.get.development.plans.for.point.json'
var origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function () {
this.addEventListener('load', function () {
if (XMLHttpRequest.callbacks){
let event = this;
event['data'] = JSON.parse(this.responseText)
XMLHttpRequest.callbacks.forEach(callBackFn=>{
callBackFn(event)