Skip to content

Instantly share code, notes, and snippets.

View melvyniandrag's full-sized avatar
🌕
A Picture of Jupiter and 4 of its Moons Through Our Telescope.

melvyniandrag

🌕
A Picture of Jupiter and 4 of its Moons Through Our Telescope.
View GitHub Profile
@melvyniandrag
melvyniandrag / extraLines.txt
Last active June 8, 2022 22:21
Elecrow 5 inch touch screen rpi config
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 400 60 6 0 0 0
dtparam=spi=on
dtparam=i2c_arm=on
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
dtoverlay=w1-gpio-pullup,gpiopin=4,extpullup=1
@melvyniandrag
melvyniandrag / AndroidManifest.xml
Created February 24, 2022 03:15 — forked from codinginflow/AndroidManifest.xml
Runtime Permission Request Tutorial
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codinginflow.permissionrequestexample">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@melvyniandrag
melvyniandrag / numbers.txt
Created September 13, 2021 22:49
numbers separated by dollar signs
This file has been truncated, but you can view the full file.
9868$4692$947$1162$4868$8663$1686$2195$8342$3578
6355$3148$1774$547$3061$4011$1219$8023$6126$838
5220$3912$8768$6277$7566$4909$961$2086$2194$9964
2442$8801$8954$5228$1320$5352$354$4287$9234$9
4249$5482$9797$1073$6847$8948$6431$1232$6273$6544
7532$8134$2706$4773$2477$8617$3434$1096$3576$8901
9076$6431$4945$3655$1805$1515$2285$351$4184$8697
2049$4601$4609$4994$1648$7209$7099$7526$5864$173
2020$9663$4503$6127$4064$8462$6028$7015$1556$6717
9272$7255$8167$5637$6856$6945$9700$436$689$2943
#!/usr/bin/bash
# Script based on this:
# https://unix.stackexchange.com/questions/144029/command-to-determine-ports-of-a-device-like-dev-ttyusb0
DEVICE_NAME="rduino"
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
(
syspath="${sysdevpath%/dev}"
@melvyniandrag
melvyniandrag / hog.py
Created January 2, 2019 23:23
Niceness Experiement
x = 1
while(True):
x+=1
@melvyniandrag
melvyniandrag / chromeFirefoxError.txt
Last active January 1, 2019 02:51
dmesg log from bad ubuntu 18.04 install
[ 517.882093] Chrome_~dThread[2514]: segfault at 0 ip 00007f4b0079f33d sp 00007f4b12404ae0 error 6 in libxul.so[7f4affa54000+65d3000]
[ 517.882114] Chrome_~dThread[2750]: segfault at 0 ip 00007f110249f33d sp 00007f111418cae0 error 6 in libxul.so[7f1101754000+65d3000]
[ 517.882141] Chrome_~dThread[2421]: segfault at 0 ip 00007f8d26c9f33d sp 00007f8d3893eae0 error 6 in libxul.so[7f8d25f54000+65d3000]
[ 517.882321] Chrome_~dThread[2555]: segfault at 0 ip 00007faa9509f33d sp 00007faaa6d69ae0 error 6 in libxul.so[7faa94354000+65d3000]
[ 615.445383] gnome-shell[1525]: segfault at 7fc31b162140 ip 00007fc31b162140 sp 00007ffe59220f48 error 15 in libxcb.so.1.1.0[7fc31b14f000+26000]
[ 797.476438] Web Content[3279]: segfault at 7 ip 0000000000000007 sp 00007fff8c29d4a8 error 14
@melvyniandrag
melvyniandrag / refs.cpp
Created November 18, 2018 20:22
Looking at reference parameters to functions
/**
* In this file we look at a couple of functions that accept an integer literal
* and one that won't.
*
* g++ -std=c++11 refs.cpp -o refs
*/
#include <iostream>
void f( const int& i ){
@melvyniandrag
melvyniandrag / pic32Timing.ino
Created June 26, 2018 03:15
Experimenting with memory access timing on pic32
const unsigned long NUM_CACHE_LINES = 16;
const unsigned long CACHE_BITS = 128;
const unsigned long DATA_ELEMS_PER_LINE = CACHE_BITS / sizeof( unsigned long );
const unsigned long N = 1979;
const int N_ITER = 10000;
volatile unsigned long stride = NUM_CACHE_LINES * DATA_ELEMS_PER_LINE;
//volatile unsigned long STRIDE = DATA_ELEMS_PER_LINE;
volatile unsigned long multiplier = 1;
@melvyniandrag
melvyniandrag / weirdbehavior.ino
Created June 26, 2018 02:23
I get about 3* faster with the simpleStride. Seems like a compiler optimization.
unsigned long time;
const unsigned long N = 999;
const unsigned long N_sq = N * N;
unsigned long bigArr[N] = {0};
unsigned long sum;
unsigned long Cache = 128;
const unsigned long NumIter = 10000;
void init_arr() {
@melvyniandrag
melvyniandrag / pic32_cache_demo.ino
Created June 26, 2018 00:37
Demonstration of the impact of cache misses on a pic32 microcontroller. This should generate the same times on arduino, because arduino has no cache.
unsigned long time;
const unsigned long N = 1000;
int bigArr[N] = {0};
int sum;
int Cache = 128;
void init_arr(){
for( int i = 0; i < N; ++i){
bigArr[i] = 1;
}