Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
@yitsushi
yitsushi / pack-unpack.rb
Created January 23, 2019 12:10
(teaching material)
id_list = [123456789, 234567891, 345678912, 456789123, 567891234, 789123456, 891234567, 912345678]
packed = id_list.pack('L*')
string_list = id_list.map(&:to_s).join(' ')
puts "Packed version: #{packed.length} bytes long"
puts "Original:"
p id_list
puts "Bytes to send:"
p packed
@yitsushi
yitsushi / random-note.md
Last active December 18, 2020 02:48
dmenu like tool in tmux

dmenu like tool in tmux

tmux.conf:

bind-key C-d split-window "pmenu"
# for horisontal split use
# bind-key C-d split-window -h "pmenu"`
@yitsushi
yitsushi / gist:77115fbe86bb6cea6febe9f19d3c7b70
Created March 14, 2019 10:18
find all dirty/with-unstracked repositories
# ~/git-dirty.function.zsh
# This is a quick function and we don't want to load all the rc files with subshell
function git-is-dirty() {
if [[ "$(git status --porcelain)" == "" ]]; then
return 0
else
return 1
fi
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yitsushi
yitsushi / thrift.rb
Last active May 24, 2019 11:47
Thrift 0.11 | Homebrew
class Thrift < Formula
desc "Framework for scalable cross-language services development"
homepage "https://thrift.apache.org/"
url "https://www.apache.org/dyn/closer.cgi?path=/thrift/0.11.0/thrift-0.11.0.tar.gz"
sha256 "c4ad38b6cb4a3498310d405a91fef37b9a8e79a50cd0968148ee2524d2fa60c2"
bottle do
cellar :any
sha256 "a26c4c6e39b346dc74c5d29ba271b9f64c537914eb3228e446e0ae2e34fa106b" => :mojave
sha256 "d1c648d84f21b567f1468625523b78d496d49954a3f5f28ce127f3eca7c0e2e4" => :high_sierra
@yitsushi
yitsushi / covid-19.py
Created March 24, 2020 12:00
covid-19 tracker
import requests
import sys
def check(name, row):
if name is None:
return True
if name == row['country'].lower():
return True
if name == row['countryInfo']['iso2'].lower():
@yitsushi
yitsushi / listen.py
Last active October 11, 2021 15:13
Quick python script to monitor DHCP traffic
#!/usr/bin/env python3
import os
import pyshark
dhcp_ports = [
67, 68, # dhcp
546, 547, # dhcpv6
]
@yitsushi
yitsushi / .git-commit
Created November 2, 2021 17:48
My fancy git commit template file
# Title here
#
# Use 50 characters maximum.
# Do not use a sentence-ending period.
#
# Prefixes:
#
# bump = bump version
# chore(subtype) = chore
# docs = documentation
#!/usr/bin/env bash
function printDebug() {
if [ -z "${1}" ]; then
return 1
fi
# That 2:
# FUNCNAME contains the printDebug call too and we want to ignore it.
if [[ ${#FUNCNAME[@]} -gt 2 ]]; then
@yitsushi
yitsushi / main.go
Last active February 9, 2022 11:16
Go: Maybe with foldl
package main
import (
"fmt"
"constraints"
)
func FoldlIter[T any, R any](init R, list (<- chan T), fold func(carry R, next T) R) R {
for value := range list {
init = fold(init, value)