Skip to content

Instantly share code, notes, and snippets.

Bent Cardan reqshark

Block or report user

Report or block reqshark

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@reqshark
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
reqshark / binary_convert.js
Last active Apr 9, 2019
binary math conversion
View binary_convert.js
// take a number 6 -> binary
console.log(convert(10))
function convert(n){
let remainder = []
while (n){
remainder.push(n % 2)
n = parseInt(n/2) // keep dividing it
}
@reqshark
reqshark / primesum.js
Last active Mar 16, 2019
summing primes from 2 million
View primesum.js
console.log(primesum(2000000))
function primesum(m){
let ret = 7, i = 1 //(ret=7) prepopulate 2 and 5, dropped by optimization
while (i++ < m) {
if (isprime(i))
@reqshark
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
reqshark / ethminer_ubuntu_nvidia.md
Created Jul 18, 2018 — forked from johnstcn/ethminer_ubuntu_nvidia.md
NVIDIA/CUDA ethminer setup under Ubuntu Server 16.04
View ethminer_ubuntu_nvidia.md

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.

Hardware

@reqshark
reqshark / 00-MINING.md
Created Jan 14, 2018 — forked from gboddin/00-MINING.md
Mining optimisation under Linux
View 00-MINING.md

Mining under linux

Disclaimer

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
reqshark / rocm.sh
Created Jan 11, 2018
asking rocm-smi about GPU power on linux?
View rocm.sh
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 ====================
View style_guide.md

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.

View vim_cheatsheet.md

Introduction

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

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@reqshark
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
ipaddr(function(addr1){
console.log(addr1)
setTimeout(function(){
You can’t perform that action at this time.