Skip to content

Instantly share code, notes, and snippets.

View sanzaru's full-sized avatar

Martin Albrecht sanzaru

View GitHub Profile
@sanzaru
sanzaru / bc.py
Last active May 13, 2020 07:56
Simple python script to byte encode a string
import array, sys
ARGV = sys.argv
if len(ARGV) <= 1 or not ARGV[1]:
print 'usage: ' + ARGV[0] + ' <string to encode>'
sys.exit(1)
inp = str(ARGV[1])
bc = ''
@sanzaru
sanzaru / searchString.sh
Created September 21, 2015 12:13
Bash function: Search for a string in a given array of strings
#
# Search for a string in a given array of strings
#
# Argumnents:
# $1: String | required | Defines the query string to search for
# $2: String | required | Array of strings to look for the query
#
# Return:
# 0: Success, query string was found
# 1: Error, query string was not found or any other error occured
### Keybase proof
I hereby claim:
* I am sanzaru on github.
* I am sanzaru (https://keybase.io/sanzaru) on keybase.
* I have a public key ASCRduI8RJMk5yOkLxztbp3Va8n4XEeHBXA4f4LJSiW_Jwo
To claim this, I am signing this object:
@sanzaru
sanzaru / ibm1401-bc.js
Last active June 2, 2020 10:27
Simple program to encode ASCII punch card files for the IBM 1401 into binary (BCD) the machine understands.
/**
* This is a simple program to encode ASCII punch card files for the IBM 1401
* into binary the machine understands.
*
* The IBM 1401 was build before ASCII was invented, so it used its own binary
* encoding for characters. This program will encode all ASCII into
* corresponding 1401 encoding.
*
* Usage: node ibm1401-bc.js <file>
*
@sanzaru
sanzaru / Collapsible.swift
Last active February 15, 2024 15:26
SwiftUI collapsible view
import SwiftUI
struct Collapsible<Content: View>: View {
@State var label: () -> Text
@State var content: () -> Content
@State private var collapsed: Bool = true
var body: some View {
VStack {
@sanzaru
sanzaru / CollapsibleDemoView.swift
Last active August 19, 2020 12:48
Demo view for collapsible view
import SwiftUI
struct CollapsibleDemoView: View {
var body: some View {
VStack(spacing: 10) {
HStack {
Text("Here we have some fancy text content. Could be whatever you imagine.")
Spacer()
}
.padding(.bottom)
@sanzaru
sanzaru / git-clearHistory
Created November 8, 2020 01:02 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@sanzaru
sanzaru / the.scene-s1-playlist.md
Last active September 11, 2021 15:27
A list containing all the music played in the first season of the web mini series "The.Scene" created by Jun Group Entertainment from about 2005.

A list containing all the music played in the first season of the web mini series "The.Scene" created by Jun Group Entertainment from about 2005.

More information about the series: https://en.wikipedia.org/wiki/The_Scene_(miniseries)

NOTE: The playlist is still incomplete as some artits and songs are complicated or impossible to research after such a long time.

Intro:

- Maylynne: Catch me
@sanzaru
sanzaru / sheet-delay.swift
Last active May 9, 2022 23:32
Example for demonstrating the delay on setting the bound variable to nil, when sheet is dismissed by drag
import SwiftUI
struct ContentView: View {
private enum ActiveSheet: Identifiable {
case first, second
var id: Int { hashValue }
}
@State private var activeSheet: ActiveSheet?
@sanzaru
sanzaru / getmodel.sh
Created August 19, 2022 16:21
RaspberryPi: Print the model and revision bash script
#!/bin/sh
tail -n 1 /proc/cpuinfo | cut -d ":" -f 2 | sed -e 's/^[[:space:]]*//'