Skip to content

Instantly share code, notes, and snippets.

Avatar

Bob Arezina barezina

  • Brisbane Australia
View GitHub Profile
@barezina
barezina / remove.php
Last active Jun 30, 2021
Bulk remove collaborator from all repos
View remove.php
<?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 / docker.sh
Last active Mar 8, 2022
Install docker and docker compose, add ubuntu user to docker group.
View docker.sh
#!/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 / asciitable.php
Last active Feb 24, 2020
PHP ascii table from 2D array
View asciitable.php
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 / backup.py
Last active Mar 13, 2021
ios backup extractor - restores an iTunes backup to it's original files
View backup.py
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 / singleton.m
Created Apr 4, 2017
Singleton for making get-post requests (passing in external block, completion handler)
View singleton.m
//
// singleton.m
//
#import "singleton.h"
typedef void(^ CompletionBlock)(NSData*, NSURLResponse*, NSError*);
@implementation singleton
@synthesize vData;