Skip to content

Instantly share code, notes, and snippets.

View mrandrewandrade's full-sized avatar

Andrew Andrade mrandrewandrade

View GitHub Profile
@mrandrewandrade
mrandrewandrade / command_line.md
Last active March 16, 2024 17:32
Commonly used command line

Video Editing

Cut a video 8 seconds to 21 seconds

ffmpeg -ss 00:00:08 -to 00:00:21 -i input.mp4 -c copy output.mp4

Convert mp4 to gif

@mrandrewandrade
mrandrewandrade / spark-the-definitive-guide.py
Created December 5, 2017 17:37
Code examples from Spark The Definitive Guide
dataset_path = "/path/to/Spark-The-Definitive-Guide/data/"
myRange = spark.range(1000).toDF("number")
divisBy2 = myRange.where("number % 2 = 0")
divisBy2.count()
flightData2015 = spark.read.option("inferSchema","true").option("header","true").csv(dataset_path + "flight-data/csv/2015-summary.csv")
@mrandrewandrade
mrandrewandrade / README.md
Last active January 1, 2016 23:36 — forked from mbostock/.block
Data Science Guide Tree Map
@mrandrewandrade
mrandrewandrade / tmux.cheat
Last active October 21, 2020 10:13 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^a w
New -s <session> Create ^a c
Attach a -t <session> Rename ^a , <name>
Rename rename-session -t <old> <new> Last ^a l (lower-L)
Kill kill-session -t <session> Close ^a &
int ledPin = 10; // LED connected to digital pin 9
int maxValue = 255;
int minValue = 0;
int increment = 5;
void setup() {
// nothing happens in setup
}
void loop() {
// fade in from min to max in increments of 5 points:
@mrandrewandrade
mrandrewandrade / command_output_to_file.markdown
Last active August 29, 2015 14:05
Write output of command to file using shell

All POSIX operating systems have 3 streams: stdin, stdout, and stderr. stdin is the input, which can accept the stdout or stderr. stdout is the primary output, which is redirected with >, >>, or |. stderr is the error output, which is handled separately so that any exceptions do not get passed to a command or written to a file that it might break; normally, this is sent to a log of some kind, or dumped directly, even when the stdout is redirected. To redirect both to the same place, use:

command > out.txt 2>&1