Skip to content

Instantly share code, notes, and snippets.

View barezina's full-sized avatar

Bob Arezina barezina

  • Brisbane Australia
View GitHub Profile
@barezina
barezina / usb-unlock
Last active April 1, 2024 21:57
a script to initramfs that allows for keyfiles on USB drives to be used to unlock 22.04 disks
#!/bin/sh
set -e
file="usbtries.txt"
if [ -e ${file} ]; then
count=$(cat ${file})
else
count=0
fi
@barezina
barezina / docker.sh
Last active March 8, 2022 06:00
Install docker and docker compose, add ubuntu user to docker group.
#!/bin/bash
apt update;
apt install -y ca-certificates curl gnupg lsb-release;
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg;
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null;
apt update;
apt install -y docker-ce docker-ce-cli containerd.io;
usermod -aG docker ubuntu;
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
@barezina
barezina / remove.php
Last active June 30, 2021 04:49
Bulk remove collaborator from all repos
<?php
require __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
/**
* Remove the specified user from all repositories
* that we are authenticated to see and manage.
*/
@barezina
barezina / backup.py
Last active March 13, 2021 05:30
ios backup extractor - restores an iTunes backup to it's original files
import sqlite3
import os
import uuid
import shutil
import re
print('ios backup python script for linux (ubuntu)')
# this function helps traverse the returned results from the db
def dict_factory(cursor, row):
@barezina
barezina / asciitable.php
Last active February 24, 2020 03:30
PHP ascii table from 2D array
function generateAsciiTable($data)
{
// Generate row widths
$rowWidths = [];
foreach ($data as $row) {
foreach ($row as $index => $cell) {
if (!isset($rowWidths[$index])) {
$rowWidths[$index] = strlen($cell) + 2;
} else {
@barezina
barezina / singleton.m
Created April 4, 2017 22:45
Singleton for making get-post requests (passing in external block, completion handler)
//
// singleton.m
//
#import "singleton.h"
typedef void(^ CompletionBlock)(NSData*, NSURLResponse*, NSError*);
@implementation singleton
@synthesize vData;