Skip to content

Instantly share code, notes, and snippets.

@nerdralph
nerdralph / py35.sh
Last active Jan 19, 2018
Python 3.5.1 download and install script for RPM-based Linux platforms
View py35.sh
#!/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 Jun 4, 2016
script to set clocks on AMD GPUs
View clocks.txt
1150,1500 R7 370
820,1500 380
1150,1250 67B1
@nerdralph
nerdralph / zec.py
Last active Oct 29, 2016
python zcash mining calculator
View zec.py
#!/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 Dec 27, 2016
llvm/OpenCL setup
View setup.sh
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 Mar 25, 2017
Ubuntu 16 kernel 4.10.5 install
View kernel4.10.5.sh
#!/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 Apr 3, 2018
spew a char to stdout
View spew.c
/* 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 Dec 24, 2019
blink example for MicroCorre using sleep and millis
View blink-MicroCore.ino
@nerdralph
nerdralph / t13tune.ino
Last active Dec 23, 2019
prototype MicroCore OSCCAL tuner for ATtiny13
View t13tune.ino
// 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 Jan 7, 2020
picoI2C ssd1306 128x32 test
View ssd1306.cpp
/* 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 Feb 5, 2020
MicroCore Oscillator Calibration
View OscillatorCalibration.ino
/*
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