Skip to content

Instantly share code, notes, and snippets.

View Marzogh's full-sized avatar
🏔️
Off the grid - as much as possible

Marzogh Marzogh

🏔️
Off the grid - as much as possible
View GitHub Profile
@Marzogh
Marzogh / arduino_serial.py
Last active January 25, 2023 16:32 — forked from ttmarek/arduino_serial.py
Python script to read serial data from the Arduino. Second file from (https://electronics.stackexchange.com/questions/54/saving-arduino-sensor-data-to-a-text-file)
import serial
import csv
import re
import matplotlib.pyplot as plt
import pandas as pd
portPath = "/dev/ttyACM0" # Must match value shown on Arduino IDE
baud = 115200 # Must match Arduino baud rate
timeout = 5 # Seconds
filename = "data.csv"
@Marzogh
Marzogh / ignore.md
Created March 1, 2018 04:09 — forked from tmaybe/ignore.md
ignoring merge conflicts for specific files in a git repository

How to Ignore Merge Conflicts for Specific Files in a Git Repository

Create a directory and git init it

$ mkdir merge-test
$ cd merge-test/
$ git init
@Marzogh
Marzogh / README.md
Created March 1, 2018 04:08 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@Marzogh
Marzogh / ASCII Pinout_ATTiny13
Last active August 15, 2017 12:17
Ascii art pinouts for various DIP chips
+---\/---+
PB5 |1* 8| VCC
PB3 |2 7| PB2
PB4 |3 6| PB1
GND |4 5| PB0
+--------+

Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to:

@Marzogh
Marzogh / quit-terminal-cleanly-command
Created March 29, 2017 02:13
Add the following line to your .bash_profile, save and exit. (On iMacs you can access this by typing 'nano ~/.bash_profile' in terminal). This will let you close your terminal window with the one word command 'quit'
alias quit='osascript -e "do shell script \"osascript -e \\\"tell application \\\\\\\"Terminal\\\\\\\" to quit\\\" &> /dev/null &\""; exit'
@Marzogh
Marzogh / dueMemory.cpp
Created October 10, 2016 00:04
Gets and outputs a number of details about the state of the RAM on an Arduino Due
/* Code courtesy of RayLivingston from the Arduino forums (http://forum.arduino.cc/index.php?topic=404908.msg2787555#msg2787555) */
void ShowMemory(void)
{
struct mallinfo mi=mallinfo();
char *heapend=sbrk(0);
register char * stack_ptr asm("sp");
pConsole->printf(" arena=%d\n",mi.arena);
pConsole->printf(" ordblks=%d\n",mi.ordblks);
@Marzogh
Marzogh / reset_arduino.ino
Created May 23, 2016 23:28
Resets Arduino in software
void(* resetFunc) (void) = 0; //declare reset function @ address 0
resetFunc(); //Call to reset
@Marzogh
Marzogh / int_bubble_sort.cpp
Last active May 23, 2016 23:28
Sorts an array of integers using a bubble sort algorithm
void sort(int a[], int size) {
for(int i=0; i<(size-1); i++) {
for(int o=0; o<(size-(i+1)); o++) {
if(a[o] > a[o+1]) {
int t = a[o];
a[o] = a[o+1];
a[o+1] = t;
}
}
}
@Marzogh
Marzogh / calculate_value_change.cpp
Last active May 23, 2016 23:28
Calculates change between numbers
int getValueChange(int currVal, int lastVal) {
if (currVal > lastVal) {
return (currVal - lastVal);
} else {
int dec = -(lastVal - currVal);
return dec;
}
}