Linux:
Cmd
->Ctrl
- Navigation
Ctrl + B : Jump to Definition
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
#!/usr/bin/env bash | |
# | |
# script install phantomjs for ci automatically build & test | |
# \curl -sSL https://gist.githubusercontent.com/dinhnv/6eee21ad7677aa93ad7be3385c0b031c/raw/install_phantomjs.sh | bash -s | |
set -euo pipefail | |
IFS=$'\n\t' | |
# workaround for gitlab cache | |
WORK_DIR=`pwd` |
document.cookie="VISITOR_INFO1_LIVE=oKckVSqvaGw; path=/; domain=.youtube.com";window.location.reload();
#!/bin/sh | |
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
set -e | |
# Must be a valid filename | |
NAME=foo | |
PIDFILE=/var/run/$NAME.pid | |
#This is the command to be run, give the full pathname | |
DAEMON=/usr/local/bin/bar |
############################################################################### | |
# Helpful Docker commands and code snippets | |
############################################################################### | |
### CONTAINERS ### | |
docker stop $(docker ps -a -q) #stop ALL containers | |
docker rm -f $(docker ps -a -q) # remove ALL containers | |
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
# exec into container |
# brew install ffmpeg | |
# brew install youtube-dl | |
# F12, copy cookies header which starts 'cookie:...' by copying as cURL of any request | |
youtube-dl https://www.facebook.com/{video url} --add-header 'cookie:...' -f bestvideo+bestaudio/best |
# How to use: | |
# add to Dockerfile, otherwise add to entrypoint script. For example: | |
# RUN mkdir -p /bin/docker-entrypoint/ \ | |
# && cp /tmp/scripts/docker-entrypoint/* /bin/docker-entrypoint/ \ | |
# && chmod +x -R /bin/docker-entrypoint/ \ | |
# ; | |
# ENTRYPOINT ["/bin/docker-entrypoint/resolve-docker-host-ip.sh", ...] | |
set -e |
#!/usr/bin/env bash | |
set -e | |
DC="${DC:-exec}" | |
APP_NAME="${APP_NAME:-hello}" | |
# If we're running in CI we need to disable TTY allocation for docker-compose | |
# commands that enable it by default, such as exec and run. | |
TTY="" |
Learning Rust
The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.
Warning
Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.
The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.