Skip to content

Instantly share code, notes, and snippets.


Bent Cardan reqshark

View GitHub Profile
reqshark / readme.markdown
Created Apr 26, 2019
why i am switching to go from javascript
View readme.markdown

promises and bloat

javascript got one thing right with callbacks. that got thrown out with promises.

error swallowing and other anonymous/bad syntax conventions

  • who cares about function declarations?
  • named functions provide an informative callstack for debugging/visibility, oops not arrows =>
  • async await is not a coroutine
  • chained promises swallow errors and are complex/unintuitive

go run

reqshark / binary_convert.js
Last active Apr 9, 2019
binary math conversion
View binary_convert.js
// take a number 6 -> binary
function convert(n){
let remainder = []
while (n){
remainder.push(n % 2)
n = parseInt(n/2) // keep dividing it
reqshark / primesum.js
Last active Mar 16, 2019
summing primes from 2 million
View primesum.js
function primesum(m){
let ret = 7, i = 1 //(ret=7) prepopulate 2 and 5, dropped by optimization
while (i++ < m) {
if (isprime(i))
reqshark / segfault.c
Created Aug 11, 2018
catch your segfault
View segfault.c
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
static void do_segv() {
/* lets do some stuff that would segfault on any system */
int *segv;
segv = 0; /* malloc(a_huge_amount); */
reqshark /
Created Jul 18, 2018 — forked from johnstcn/
NVIDIA/CUDA ethminer setup under Ubuntu Server 16.04

Headless Ethminer (nVidia) Setup Guide

Cian Johnston, July 2017

A couple of weeks ago, I decided I should put my gaming rig to work crypto mining. I did not expect to make any significant profit on this, it was more of a fun project to set up. However, there were a large number of tutorials and guides already out there, and many were more than a year out of date.

This guide assumes the reader already has a crypto wallet set up, is comfortable with Linux and the command line, and knows how to use Google if they run into problems.

The end result is an Ubuntu 16.04 LTS headless server running CUDA ethminer via systemd.


reqshark /
Created Jan 14, 2018 — forked from gboddin/
Mining optimisation under Linux

Mining under linux


I'm in no case responsible for fried hardware, erased software or burning down houses. Make sure your miners are always well cooled.

General recommendation

Though you can easily mix nVidia and AMD in the same rig with Linux, it's recommended to use a different thread for each platform so a Driver crash doesn't bring the whole rig down. It should be noted however, that some mining software have trouble when both architecture are found on the same rig.

reqshark /
Created Jan 11, 2018
asking rocm-smi about GPU power on linux?
miner@rig3:~$ /opt/rocm/bin/rocm-smi -P
==================== ROCm System Management Interface ====================
GPU[1] : Cannot get GPU power Consumption: Average GPU Power not supported
GPU[2] : Cannot get GPU power Consumption: Average GPU Power not supported
GPU[0] : Cannot get GPU power Consumption: Average GPU Power not supported
==================== End of ROCm SMI Log ====================

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.



  • C-a == Ctrl-a
  • M-a == Alt-a


:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
reqshark / ip.js
Last active May 6, 2017
get your ips
View ip.js
const ip_regex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/
const digits = /^\d\d\.|^\d\d\d\./g
const local = /^127\.|^10\.|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-1]\.|^192\.168\./g
const RTCPeerConnection = window.RTCPeerConnection
|| window.mozRTCPeerConnection || window.webkitRTCPeerConnection