Skip to content

Instantly share code, notes, and snippets.

View revoltez's full-sized avatar
🏠
Working from home

Houadef Salih revoltez

🏠
Working from home
View GitHub Profile
@bojidar-bg
bojidar-bg / Connection.i
Last active December 29, 2023 13:47
Virtual machine interaction net bootstrap for https://inet.run/playground/
require "./SymbolMap.i" // Diamond imports don't work
// import { List, null } from "./List.i"
// import { del, delOut, dup, dupOut } from "./Generic.i"
type Edge
type Connection
node pos(
edge: Edge,
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active May 6, 2024 11:21
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
import Web3 from 'web3'
/*
* 1. Check for injected web3 (mist/metamask)
* 2. If metamask/mist create a new web3 instance and pass on result
* 3. Get networkId - Now we can check the user is connected to the right network to use our dApp
* 4. Get user account from metamask
* 5. Get user balance
*/
@heroheman
heroheman / ranger-cheatsheet.md
Last active May 5, 2024 13:27
Ranger Cheatsheet

Ranger Cheatsheet

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
R Reload current directory
? Ranger Manpages / Shortcuts
@DarinM223
DarinM223 / Associated Types.md
Last active September 21, 2023 13:24
Associated types

Introduction to associated types

One of the most useful things in typed programming languages is generics. Generics allows you to write code that works across multiple types while still being checkable by the compiler. Even better is that with many languages like Rust and C#, generics have a distinct performance advantage over runtime casting. However although generics are extremely useful, many programming languages that have them don't allow for convenient ways of expressing them, especially for traits/interfaces. Like in Java if you want a generic interface you are forced to use the same Name<Type1, Type2, Type3, ...> syntax that you would use for a class. However, that often leads to ugly overly-verbose code.

Here's an example: Lets say that you have two traits/interfaces Foo and Bar that depend on three subtypes and you wanted a function that takes in any implementation of both Foo and Bar and returns the first type of Foo and the third type of Bar. The traditional Rust version that is similar to o

@IQAndreas
IQAndreas / caesar-cipher.sh
Last active August 30, 2023 09:39
A really simple Caesar Cipher in Bash (or Shell) using `tr`, can also easily be adjusted to encrypt/decrypt ROT13 instead.
# Caesar cipher encoding
echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" | tr '[A-Z]' '[X-ZA-W]'
# output: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD
# Caesar cipher decoding
echo "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" | tr '[X-ZA-W]' '[A-Z]'
# output: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
# Can also be adjusted to ROT13 instead