Skip to content

Instantly share code, notes, and snippets.

@nerdralph
nerdralph / py35.sh
Last active January 19, 2018 20:35
Python 3.5.1 download and install script for RPM-based Linux platforms
#!/bin/sh
sudo yum -y update
sudo yum -y groupinstall "Development tools"
sudo yum -y install zlib-devel openssl-devel
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
tar xJf Python-3.5.1.tar.xz
cd Python-3.5.1
./configure --prefix=/usr/local
sudo make install
python3 --version
@nerdralph
nerdralph / clocks.txt
Created June 4, 2016 22:31
script to set clocks on AMD GPUs
1150,1500 R7 370
820,1500 380
1150,1250 67B1
@nerdralph
nerdralph / zec.py
Last active October 29, 2016 21:17
python zcash mining calculator
#!/usr/bin/python2
# arg1 = current block number
# arg2 = current network rate in thousands of solutions per second
# arg3 = your solution rate
BLOCKS_PER_DAY = 576*10 # 2.5 minute block time
RAMP_BLOCKS = 20000 # mining slow start
import sys
@nerdralph
nerdralph / setup.sh
Last active December 27, 2016 16:26
llvm/OpenCL setup
wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository -y "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main"
sudo apt-get update
sudo apt-get install clang-3.9
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 10
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.9 10
#install POCL deps http://portablecl.org/docs/html/install.html
# sudo apt-get install libhwloc-dev
@nerdralph
nerdralph / kernel4.10.5.sh
Created March 25, 2017 18:06
Ubuntu 16 kernel 4.10.5 install
#!/bin/sh
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.5/linux-headers-4.10.5-041005_4.10.5-041005.201703220931_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.5/linux-headers-4.10.5-041005-generic_4.10.5-041005.201703220931_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.10.5/linux-image-4.10.5-041005-generic_4.10.5-041005.201703220931_amd64.deb
sudo dpkg -i *.deb
@nerdralph
nerdralph / spew.c
Created April 3, 2018 15:24
spew a char to stdout
/* 2018 Ralph Doncaster public domain software */
/* spew a char to stdout, null if none provided */
#include <unistd.h>
#include <string.h>
int main(int argc, char** argv){
char buf[1024];
char c = 0;
if( argc > 1 ) c = *argv[1];
@nerdralph
nerdralph / blink-MicroCore.ino
Last active December 24, 2019 14:56
blink example for MicroCorre using sleep and millis
@nerdralph
nerdralph / t13tune.ino
Last active December 23, 2019 17:40
prototype MicroCore OSCCAL tuner for ATtiny13
// t13 OSCCAL tuner
// Ralph Doncaster 2019 public domain software
// repeatedly press 'x' until OSCCAL value stabilizes
// output value is timing delta in cycles followed by OSCCAL
#define BAUD_RATE 115200
#include <BBUart.h>
#include <avr/sleep.h>
#define UART_RX 1
@nerdralph
nerdralph / ssd1306.cpp
Created January 7, 2020 19:28
picoI2C ssd1306 128x32 test
/* ssd1306 test for picoI2C
* Ralph Doncaster (c) 2019
* free software - MIT license
*/
#include <stdint.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "picoI2C.h"
@nerdralph
nerdralph / OscillatorCalibration.ino
Created February 5, 2020 00:13
MicroCore Oscillator Calibration
/*
ATtiny13 internal oscillator tuner
By Ralph Doncaster (2019)
Tweaked and tuned by MCUdude
------------------------------------------------------------------------------
[ See diagram: https://github.com/MCUdude/MicroCore#minimal-setup ]
Tunes the internal oscillator using a software serial implementation