Skip to content

Instantly share code, notes, and snippets.

@D-Nice
D-Nice / script-template.sh
Created December 15, 2020 21:42 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@D-Nice
D-Nice / fizzbuzz.nim
Created June 17, 2020 22:56
Showcase of my take on fizzbuzz for a friend that is learning some programming languages. Try at https://play.nim-lang.org/#ix=2prQ
import sequtils, tables, strutils
const gameRange = (1..100).toSeq
const gameRuleTable = {
3: "Fizz",
5: "Buzz"
}.toOrderedTable
proc gameRules(x: int): string =
for k,v in gameRuleTable.pairs:
@D-Nice
D-Nice / notify-send-all
Created June 8, 2020 01:43
A posix shell compliant script for sending a notification to all logged in users with a display in use (tested on void, put in an sbin path, needs to run as root)
#!/bin/sh
verbose_echo()
{
[ -n "${VERBOSE##[NFnf]*}" ] && \
echo "$@"
}
LOGGED_USERS=$(who | awk '{print $1 " "}')
for user in $LOGGED_USERS; do
Ciphers aes192-ctr,aes256-ctr,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group18-sha512
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com
HostKeyAlgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
@D-Nice
D-Nice / afl.out
Created February 7, 2020 21:00
week of fuzzy lopping argon2
american fuzzy lop 2.52b (output)
┌─ process timing ─────────────────────────────────────┬─ overall results ─────┐
│ run time : 7 days, 20 hrs, 28 min, 6 sec │ cycles done : 186 │
│ last new path : 1 days, 0 hrs, 2 min, 8 sec │ total paths : 88 │
│ last uniq crash : none seen yet │ uniq crashes : 0 │
│ last uniq hang : none seen yet │ uniq hangs : 0 │
├─ cycle progress ────────────────────┬─ map coverage ─┴───────────────────────┤
│ now processing : 87 (98.86%) │ map density : 0.74% / 0.97% │
│ paths timed out : 0 (0.00%) │ count coverage : 1.73 bits/tuple │
@D-Nice
D-Nice / init.vim
Last active December 10, 2019 03:23
just an example vimrc for neovim
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
@D-Nice
D-Nice / underhanded_solidity_storage_array.sol
Created June 15, 2018 19:19
storage array which refs to storage slot 0, overwrites whatever is in storage 0
pragma solidity ^0.4.0;
import "browser/oraclizeapi.sol";
contract brokenWOraclize is usingOraclize {
event DEBUG(uint[] a);
function brokenWOraclize() {
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}
contract t {
function getFirstCsv() returns (string c) {
string memory _s = "1525452452,2,3,4,5";
//return 1;
assembly {
/*mstore(add(mload(0x40), 0x20), mload(_s))
mstore(add(mload(0x40), 0x40), mload(add(_s, 0x20)))
mstore(mload(0x40), 0x20)
return(mload(0x40), 0x60)*/
let x := 0
@D-Nice
D-Nice / Cache.py
Created February 20, 2018 23:29
md5 hash memory dict cache
from datetime import datetime, timedelta
from hashlib import md5
from copy import deepcopy
import json
# creates an md5 hash dict for caching in memory
class Cache:
# args expect seconds
def __init__(self, expiry, clearInterval):
if (not type(expiry) == int) or (not type(clearInterval) == int):

Keybase proof

I hereby claim:

  • I am d-nice on github.
  • I am dnice (https://keybase.io/dnice) on keybase.
  • I have a public key ASCtj_8nf-4wse-7bAJeiOcnm0ItHHH7sW-VW7VwWoS0awo

To claim this, I am signing this object: