Skip to content

Instantly share code, notes, and snippets.

@D-Nice
D-Nice / fizzbuzz.nim
Created Jun 17, 2020
Showcase of my take on fizzbuzz for a friend that is learning some programming languages. Try at https://play.nim-lang.org/#ix=2prQ
View fizzbuzz.nim
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 Jun 8, 2020
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)
View notify-send-all
#!/bin/sh
verbose_echo()
{
[ -n "${VERBOSE##[NFnf]*}" ] && \
echo "$@"
}
LOGGED_USERS=$(who | awk '{print $1 " "}')
for user in $LOGGED_USERS; do
View sshd_config
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 Feb 7, 2020
week of fuzzy lopping argon2
View afl.out
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 Dec 10, 2019
just an example vimrc for neovim
View init.vim
" 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 Jun 15, 2018
storage array which refs to storage slot 0, overwrites whatever is in storage 0
View underhanded_solidity_storage_array.sol
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);
}
View csv.asm.sol
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 Feb 20, 2018
md5 hash memory dict cache
View Cache.py
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):
View keybase.md

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:

View precompile_direct.sol
contract Precompile {
function foo (bytes) returns (bytes32);
}
contract Testcontract {
bytes32 last;
event Debug(string message, bytes32 res);
Precompile prec = Precompile(0x0000000000000000000000000000000000000002);
You can’t perform that action at this time.