Action | tmux | screen |
---|---|---|
start a new session | tmux tmux new tmux new-session |
screen |
start a new session with a name | tmux new -s name | screen -S name |
re-attach a detached session | tmux attach tmux attach-session |
screen -r |
re-attach a detached session with a name | tmux attach -t name tmux a -t name |
screen -r name |
re-attach an attached session (detaching it from elsewhere) | tmux attach -dtmux attach-session -d | screen -dr |
#!/bin/zsh | |
# Script to generate thumbnails of a video and combine into one tile image. | |
# | |
# CAUTION: | |
# FFprobe might fail to extract duration info from a MKV container. Use | |
# ffmpeg -i video.mkv -c:v copy -c:a copy video.mp4 | |
# to swap to an MP4 container. | |
# | |
# Dependencies: | |
# 1. ffmpeg |
#Mac Setup
These are the steps I go to setup a new macbook.
-
Install homebrew
Packages to install: ack android-sdk bash bash-completion brew-rmtree calc colordiff cowsay docker fish git git-lfs go gradle hh htop mongodb node python python3 ruby tree unrar zsh zsh-completions fzf ngrok ctags tmux neovim
function string_to_slug (str) { | |
str = str.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; | |
var to = "aaaaeeeeiiiioooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) { | |
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); | |
} |
Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.
You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.
<?php | |
namespace Application\Entity; | |
/** | |
* Class Foo | |
* | |
* @package Application\Entity | |
*/ | |
class Foo | |
{ |
#!/bin/sh | |
# PATH TO YOUR HOSTS FILE | |
ETC_HOSTS=/etc/hosts | |
# DEFAULT IP FOR HOSTNAME | |
IP="127.0.0.1" | |
# Hostname to add/remove. | |
HOSTNAME=$1 |
#MongoDB 3.2.x Sharding Sharding is used when the database is too large to run on a single server and you need to spread the load across multiple servers. The name itself refers to the breaking (sharding) of the data into seperate groups of data which will reside on different servers.
##Configuration Server Start the server on your server (myserver0)
mongod --configsvr --dbpath /data
On myserver1 start the shard giving the configuration server as the --configdb
option
<?php | |
/** | |
* simple method to encrypt or decrypt a plain text string | |
* initialization vector(IV) has to be the same when encrypting and decrypting | |
* | |
* @param string $action: can be 'encrypt' or 'decrypt' | |
* @param string $string: string to encrypt or decrypt | |
* | |
* @return string | |
*/ |
/* Parse a string function definition and return a function object. Does not use eval. | |
* @param {string} str | |
* @return {function} | |
* | |
* Example: | |
* var f = function (x, y) { return x * y; }; | |
* var g = parseFunction(f.toString()); | |
* g(33, 3); //=> 99 | |
*/ | |
function parseFunction (str) { |