Skip to content

Instantly share code, notes, and snippets.

@kilobytesecurity
kilobytesecurity / cheatsheet.sol
Created December 17, 2021 08:44 — forked from patrickd-/cheatsheet.md
Solidity – Compilable Cheatsheet
// SPDX-License-Identifier: MIT
// ^ recommended, included machine readable in bytecode metadata
// Software Package Data Exchange is an open standard
pragma solidity ^0.8.7;
// ^ floating pragma, min 0.8.7 max excluding 0.9.0
// same as complex pragma: pragma solidity >=0.8.7 <0.9.0;
// major.breakingchanges.bugfixes
// only makes the compiler check for compatibility and throws error if not matching!
// should only be floating during development, fixed everywhere during testing & deployment
# Instructions for fresh install
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume --daemon
# reboot
$ source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
$ echo 'export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH' | tee -a ~/.zshrc
$ echo 'source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh' | tee -a ~/.zshrc
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
$ nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
@573
573 / readme.md
Last active April 28, 2022 11:03
how to initially set up home-manager

Put this in a vim buffer and in command mode run :w !bash to execute buffer contents via bash:

If you get something along

/nix/store/61mibb0k5mxnsxzb4x2737cbysn4c5ha-home-manager/bin/home-manager: line 71: NIX_PATH: unbound variable

check if you have run this already:

. ~/.nix-profile/etc/profile.d/nix.sh
" 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'
@Andrious
Andrious / ListViewScrollController.dart
Last active March 9, 2023 15:29
ListView ScrollController Example
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp(
items: List<String>.generate(10000, (i) => "Item $i"),
));
}
class MyApp extends StatefulWidget {
@blackcater
blackcater / diagrams.md
Created July 6, 2018 16:45
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@palmskog
palmskog / TreeMap.dfy
Last active July 12, 2023 10:18
Dafny Tree Map implementation
module Util {
datatype Option<T> = Some(v:T) | None
function unionMap<U(!new), V>(m: map<U,V>, m': map<U,V>): map<U,V>
requires m !! m'; // disjoint
ensures forall i :: i in unionMap(m, m') <==> i in m || i in m';
ensures forall i :: i in m ==> unionMap(m, m')[i] == m[i];
ensures forall i :: i in m' ==> unionMap(m, m')[i] == m'[i];
{
@dvlden
dvlden / ffmpeg.md
Last active May 14, 2024 14:25
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@AndrewDryga
AndrewDryga / erl-observe.sh
Last active July 11, 2023 01:20
Script for connecting Erlang Observer to remote node hosted in Kubernetes
#!/bin/bash
# This script provides easy way to debug remote Erlang nodes that is running in a kubernetes cluster.
# Usage: ./erl-observe.sh -l app=my_all -n default -c erlang_cookie
#
# Don't forget to include `:runtime_tools` in your mix.exs application dependencies.
set -e
# Trap exit so we can try to kill proxies that has stuck in background
function cleanup {
echo " - Stopping kubectl proxy."