Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View avindra's full-sized avatar
🙏
Acepit

Avindra Goolcharan avindra

🙏
Acepit
View GitHub Profile
package main
import (
"crypto/sha256"
"encoding/hex"
"fmt"
"log"
"sync"
)
const LOOKUP =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
export function encodeBase64(buffer) {
const view = new Uint8Array(buffer);
let out = [];
for (let i = 0; i < view.length; i += 3) {
const [b1, b2 = 0x10000, b3 = 0x10000] = view.subarray(i, i + 3);
out.push(
b1 >> 2,
@anotherjesse
anotherjesse / README.md
Created September 25, 2021 13:35
golang ffmpeg imagepipe streaming

using golang to create image pipe for ffmpeg

If you want to stream a slideshow using ffmpeg, it seems like one easy way to do it is to create an imagepipe of the files.

This can then be streamed to twitch.tv or youtube ... https://trac.ffmpeg.org/wiki/StreamingGuide

This sample cycles between images on disk

usage

@DavidBuchanan314
DavidBuchanan314 / life.c
Last active August 9, 2023 23:12
Yet another reformatting of my tiny game of life implementation. Valid ANSI C with no (default) compiler warnings or UB
#define F\
for(i=l;i\
<l*4; i++)
main(){int
i,j,w=512,
n,l=w*w,o[
]={~w,-w,-
w+1,-1,1,w
-1,w,w+1},
b[l*5];F b
@awerlang
awerlang / README
Last active February 22, 2024 01:24
A zypper wrapper that maximizes network throughput
zypper-download
===============
Downloads packages using any amount of available openSUSE mirrors.
Installation
------------
Copy both files to the following locations:
// ==UserScript==
// @name Disable onmousedown in Google search results page
// @namespace https://gist.github.com/chris-kwl/6172eb00971ab81bf99a213682b42e21
// @include http://www.google.tld/search?*
// @include https://www.google.tld/search?*
// ==/UserScript==
(function () {
var disableOnmousedown = function (node) {
var a, i;
@bewuethr
bewuethr / dfinit
Last active November 11, 2023 18:13
Dotfiles initialization script
#!/usr/bin/env bash
while getopts 'l:' opt; do
case $opt in
l) branch=$OPTARG ;;
*) exit 1 ;;
esac
done
if [[ -n $branch ]]; then
@rylev
rylev / learn.md
Created March 5, 2019 10:50
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@harish2704
harish2704 / zypper_dup_print_urls.py
Created October 1, 2018 18:17
parallel downloads while doing zypper distribution upgrade
#!/usr/bin/env python2
"""
This script will print package urls which need to be downloaded for 'distrubution upgrade'
Printed urls can be used for downloading packages in parallel.
For eg: we can use GNU parallel commanline tool along with wget/curl for parallel downloading
python2 zypper_dup_print_urls.py | parallel --tmuxpane -j4 --colsep ' ' mkdir -p '{1}/{2}' \; cd '{1}/{2}' \; wget -c {3}
will download packages with 4 simultaneous downloads
"""
@boreycutts
boreycutts / i3-gaps_installation_guide.md
Last active January 30, 2024 19:05
A simple installation guide for i3-gaps

Installing i3-gaps

Dependencies

i3-gaps has some packages that are required for it to work so install these things:

sudo apt install libxcb1-dev libxcb-keysyms1-dev libpango1.0-dev libxcb-util0-dev libxcb-icccm4-dev libyajl-dev libstartup-notification0-dev libxcb-randr0-dev libev-dev libxcb-cursor-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf xutils-dev libtool automake

You also need to install libxcb-xrm-dev, but I got Unable to locate package libxcb-xrm-dev when trying to install from the apt repositories on Ubuntu 16.04. If this happens to you, just install it from source using these commands:

mkdir tmp