This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert FLAC to MP3 cheatsheet | |
find . -name "*.flac" -exec ffmpeg -i {} -acodec libmp3lame -ab 320k {}.mp3 \; | |
find . -name "*.flac.mp3" -exec rename flac.mp3 mp3 {} \; | |
find . -name "*.flac" -exec rm {} \; | |
# Speed up a video | |
./ffmpeg -i original.avi -b:v 5182k -filter:v "setpts=PTS/4" faster.avi | |
# Merge PDFs | |
pdfunite in-1.pdf in-2.pdf in-3.pdf out.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set prefix key to Ctrl-a | |
set -g prefix C-a | |
# Set vi mode | |
set-window-option -g mode-keys vi | |
setw -g mode-keys vi | |
# Send C-a to apps when presses twice | |
bind C-a send-prefix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import numpy as np | |
ALIVE = 1 | |
DEAD = 0 | |
def grid_get_wrapped(grid, x, y): | |
height, width = grid.shape | |
x = x % width |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
x = int(sys.argv[1]) | |
y = int(sys.argv[2]) | |
print('The result is', x + y) | |
# usage: | |
# python using_command_line_arguments.py 5 3 | |
# The result is 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scp /path/to/project/directory username@hostname:/path/to/project/on/the/server | |
ssh username@hostname "cd /path/to/project/on/the/server; python script.py arg1 arg2 arg3" | |
scp username@hostname:/path/to/project/on/the/server/results . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx: | |
build: ./nginx | |
volumes_from: | |
- web | |
ports: | |
- "9768:8000" | |
links: | |
- web | |
restart: always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.5.1 | |
RUN mkdir /code | |
WORKDIR /code | |
ADD . /code/ | |
RUN pip install -r requirements/run.txt | |
ENV DJANGO_SETTINGS_MODULE xteams.settings.prod | |
RUN mkdir /staticfiles | |
RUN python manage.py collectstatic --noinput --clear |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build the three containers | |
# Images are automatically fetched, if necessary, from docker hub | |
docker-compose build | |
# Start a new web container to run migrations | |
# Use --rm to remove the container when the command completes | |
docker-compose run --rm web python manage.py migrate | |
# Run everything in the background with -d | |
docker-compose up -d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 4; | |
events { worker_connections 1024; } | |
http { | |
server { | |
listen 8000; | |
location /static { | |
include mime.types; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name xteams.nagasaki45.com; | |
location / { | |
proxy_set_header Host xteams.nagasaki45.com; | |
proxy_pass http://localhost:9768; | |
} | |
} |