Skip to content

Instantly share code, notes, and snippets.

View reqshark's full-sized avatar
🪂
ridge soaring

Bent Cardan reqshark

🪂
ridge soaring
View GitHub Profile

Installation

Installing dependencies

sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
                       libnotify-dev libgnome-keyring-dev libgconf2-dev \
                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \
                       gcc-multilib g++-multilib \
                       libgtk2.0-0 libgconf-2-4 \
                       libasound2 libxtst6 libxss1 libnss3 xvfb \
@reqshark
reqshark / readme.markdown
Created April 26, 2019 05:18
why i am switching to go from javascript

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 April 9, 2019 00:01
binary math conversion
// 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 March 16, 2019 00:20
summing primes from 2 million
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 August 11, 2018 00:32
catch your segfault
#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 July 18, 2018 18:40 — forked from johnstcn/ethminer_ubuntu_nvidia.md
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.

Hardware

@reqshark
reqshark / 00-MINING.md
Created January 14, 2018 04:32 — forked from gboddin/00-MINING.md
Mining optimisation under Linux

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 January 11, 2018 22:31
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 ====================
@reqshark
reqshark / style_guide.md
Created August 8, 2017 07:55 — forked from dominictarr/style_guide.md
style guide

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.

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