Skip to content

Instantly share code, notes, and snippets.

View anjannath's full-sized avatar
🏴‍☠️

Anjan Nath anjannath

🏴‍☠️
  • Red Hat
  • Earth
View GitHub Profile
@anjannath
anjannath / git-compressing-and-deltas.md
Created May 30, 2020 18:19 — forked from matthewmccullough/git-compressing-and-deltas.md
Git, Compression, and Deltas - An explanation

Git Compression of Blobs and Packfiles.

Many users of Git are curious about the lack of delta compression at the object (blob) level when commits are first written. This efficiency is saved until the pack file is written. Loose objects are written in compressed, but non-delta format at the time of each commit.

A simple run though of a commit sequence with only the smallest change to the image (in uncompressed TIFF format to amplify the observable behavior) aids the understanding of this deferred and different approach efficiency.

The command sequence:

Create the repo:

CRC has a daemon, which can be used to do some basic CRC operations, to start the daemon run crc daemon or with debug logging crc daemon --log-level debug In case of macOS and Windows, crc setup --enable-experimental-features will start the daemon but it'll also start the tray.

The daemon when started, listens on a Unix socket at $CRC_HOME/crc.sock, (~/.crc/crc.sock in linux and macOS) for commands/requests.. After connecting to the socket, it accepts commands as a JSON.

It understands a subset of the crc CLI commands:

CLI commands Daemon api Response
import urllib2
import json
def rpc_call(url, method, args):
data = json.dumps({
'id': 1,
'method': method,
'params': [args]
}).encode()
@anjannath
anjannath / bullshit.js
Created October 24, 2019 13:27 — forked from raydog/bullshit.js
Bullshit as a Service
var E_PREFIX_RATE = 0.25;
// All of our word lists:
var _word_lists = {
verb : [
"implement", "utilize", "integrate", "streamline", "optimize", "evolve", "transform", "embrace",
"enable", "orchestrate", "leverage", "reinvent", "aggregate", "architect", "enhance", "incentivize",
"morph", "empower", "envisioneer", "monetize", "harness", "facilitate", "seize", "disintermediate",
@anjannath
anjannath / tmux.md
Created October 21, 2019 05:55 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@anjannath
anjannath / Vagrantfile
Created April 5, 2019 06:09 — forked from ironcladlou/Vagrantfile
OpenShift 4.0 Installer on macOS
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "generic/fedora28"
config.vm.network "public_network"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
config.vm.provider "vmware_desktop" do |v|
v.ssh_info_public = true
v.vmx["numvcpus"] = "2"
@anjannath
anjannath / irc.md
Created February 22, 2019 08:02 — forked from xero/irc.md
irc cheat sheet

#IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

##The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
    • Leaves the specified channel.
#!/usr/bin/env bash
vol_list=$(sudo virsh vol-list --pool default | grep test1 | awk '{print $1}')
for vol in $vol_list
do
sudo virsh vol-delete $vol --pool default
done
sudo virsh net-destroy test1
sudo virsh net-undefine test1
@anjannath
anjannath / tmux-cheatsheet.markdown
Created November 22, 2018 06:41 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@anjannath
anjannath / GoConcurrency.md
Created July 26, 2018 11:03 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines