Skip to content

Instantly share code, notes, and snippets.

@cy6erlion
cy6erlion / letter-frequency.js
Last active May 15, 2020 18:36
Javascript Letter Frequency Analyzer.
// Takes an array of characters or a string
function analyze(input){
var chars = undefined;
var obj = {};
if(input instanceof Array){
chars = input;
} else if(typeof input === 'string' || input instanceof String) {
chars = input.split("");
} else return null;
@cy6erlion
cy6erlion / git_pretty_log.sh
Created January 27, 2020 16:37
Pretty git branch graphs
git log --all --decorate --oneline --graph
@cy6erlion
cy6erlion / base64.sh
Created December 13, 2019 13:20
Base64 encoding
echo "ABC" | base64
@cy6erlion
cy6erlion / git_change_author.sh
Created December 13, 2019 13:19
Git change all commit author
git rebase --root --interactive --exec "git commit --amend --author='name <email>' --no-edit"
@cy6erlion
cy6erlion / create_db.sh
Created December 13, 2019 13:18
Create a Postgres database
sudo -u postgres psql -c 'create database test;'
sudo -u postgres psql -c 'grant all privileges on database test to username;'
@cy6erlion
cy6erlion / download_website.sh
Created December 13, 2019 13:17
Download a website
wget -r <web address>
@cy6erlion
cy6erlion / avi_to_mp4.sh
Created December 13, 2019 13:17
avi to mp4 converter
#!/bin/bash
for i in *.avi;
do ffmpeg -i "$i" -c:v libx264 -preset ultrafast "$(basename "$i" .avi)".mp4;
done
@cy6erlion
cy6erlion / volume.sh
Created December 13, 2019 13:15
Set volume from terminal
amixer -D pulse sset Master 100%
# sets the volume to 100%

There are two types of errors:

  • Recoverable Errors
  • Unrecoverable Errors

Rust uses Result<T, E> for handling recoverable errors and the panic! macro to for unrecoverble errors.

Example

Keybase proof

I hereby claim:

  • I am cy6erlion on github.
  • I am cy6erlion (https://keybase.io/cy6erlion) on keybase.
  • I have a public key ASA-mGpxoTFpG4q5i5f9axUrjGDUtofeShBmgDyLzaurXwo

To claim this, I am signing this object: