This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
/* | |
Exercise about the Rust error handling. | |
Follow the instructions in the comments "Exercise" below. | |
References: | |
Book: https://doc.rust-lang.org/nightly/book/ch09-00-error-handling.html | |
Rust Standard Library: https://doc.rust-lang.org/stable/std/index.html | |
Crates IO: https://crates.io/ | |
random: https://rust-random.github.io/rand/rand/fn.random.html |
/* Composable errors via traits | |
A major challenge (among several) in error handling is how to deal with | |
disjoint error types produced by the libraries you use (as well as by | |
your own program) in a consistent and ergonomic way. Rust's `?` operator | |
improves the ergonomics of error handling, but it can only be used with | |
a single error type throughout a single function. Libraries define their | |
own error types and they don't know about each other, nor about the calling | |
program. So if we want to deal with errors from different libraries as | |
a single type (an sum or enum of the different underlying error types), we |
// Transfering ownership of a var to a function, and then back to main() | |
fn main() { | |
let mut array_main: [Vec<u8>; 3] = [vec![1], vec![2, 4], vec![]]; | |
print(&mut array_main); //pass as mutable reference to array_main | |
println!("{:?}", array_main); | |
} | |
fn print(array: &mut [Vec<u8>; 3]) -> &[Vec<u8>; 3] { | |
for e in array.iter() { | |
println!("{:?}", e) |
# ------------------------------------------------------------------------------------------------------------------------- | |
# DOCKER | |
# | |
# https://docs.docker.com/ | |
# | |
# AWS ECR (Elastic Container Registry) used to store different versions of the same image (tags) | |
# image is like a template, and a container is what uses the template to start an environment you can interact with | |
# ------------------------------------------------------------------------------------------------------------------------- | |
docker pull "image_name:version" # default is to pull from dockerhub |
ffmpeg -ss 00:00:01.000 -i input.mov -t 00:00:09.000 output.gif | |
// max 20sec for github |
type Store interface { | |
GetFollowers(userID string) ([]models.User, error) | |
} | |
type DatabaseStore struct { | |
// wrap sql connection | |
// or any other driver that your database needs | |
} | |
func (s *DatabaseStore) GetFollowers(userID string) ([]models.User, error) { |
# AUTHENTICATION: | |
cat ~/.netrc | |
machine github.com login <login-id> password <token-password> // This is dangerous and not recommended -- use SSH Auth instead | |
// Github SSH Auth Guide: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent | |
# SUBMIT BUG FIX: | |
git clone https://github.com/***.git | |
git checkout -b bug-fix-brokenthingdescription //git switch -c <new-branch> if moving changed from master | |
# **DO CODING CHANGES** |
# From: http://www.nuclearphynance.com/Show%20Post.aspx?PostIDKey=93267 | |
import win32com.client | |
import datetime | |
import pandas | |
def csiTicker2Number(csiTicker): | |
ua=win32com.client.Dispatch("UA.API2") | |
ua.MarketSymbol = csiTicker | |
ua.IsStock = 1 |