Skip to content

Instantly share code, notes, and snippets.

View zgulde's full-sized avatar

Zach Gulde zgulde

View GitHub Profile

MacOS Keyboard Shortcuts

These work (almost) universally in every application in MacOS, the only exception is text editors, which usually prefer their own key bindings.

Interestingly, these are all the same shortcuts you can use in the terminal (through readline), and are the standard key bindings for emacs.

  • Ctrl + a: go to the beginning of the line
  • Ctrl + e: go to the end of the line
tmux-256color|tmux with 256 colors,
sitm=\E[3m, ritm=\E[23m,
smso=\E[7m, rmso=\E[27m,
use=screen-256color,
@zgulde
zgulde / alt
Last active December 1, 2017 01:39
# see https://apple.stackexchange.com/questions/249307/tic-doesnt-read-from-stdin-and-segfaults-when-adding-terminfo-to-support-italic/249385
# A screen-256color based TERMINFO that adds the escape sequences for italic.
# run to add to term db: tic tmux.terminfo
tmux|tmux terminal multiplexer,
ritm=\E[23m, rmso=\E[27m, sitm=\E[3m, smso=\E[7m, Ms@,
use=xterm, use=screen,
tmux-256color|tmux with 256 colors,
use=xterm-256color, use=tmux,

Setting up websockets in production

If you have a spring boot application that is using websockets, and you have a site deployed with the codeup tomcat setup, follow the instructions below:

Nginx Config

Add the following to the nginx config for your site in the location / block and restart nginx

use test_db;
CREATE TABLE IF NOT EXISTS items (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
item TEXT NOT NULL,
PRIMARY KEY (id)
);
-- 25
insert into items(item) values
class SuperClass {
public SuperClass() {
System.out.println("Parent constructor!");
}
}
public class ConstructorTest extends SuperClass {
private String something;
public ConstructorTest(String something) {
@zgulde
zgulde / test.sh
Created November 4, 2017 00:39
Example of parsing command line args
while [[ $# -gt 0 ]]; do
arg=$1; shift
case $arg in
-d) domain=$1; shift;;
--domain=*) domain=${arg#*=};;
-g) enable_git=true;;
--git-deployment) enable_git=true;;
*) echo "Unknown arg: $arg"; exit 1;;
esac
done
@zgulde
zgulde / test.sh
Created November 4, 2017 00:38
Example of parsing command line args
while [[ $# -gt 0 ]]; do
arg=$1; shift
case $arg in
-d) domain=$1; shift;;
--domain=*) domain=${arg#*=};;
-g) enable_git=true;;
--git-deployment) enable_git=true;;
*) echo "Unknown arg: $arg"; exit 1;;
esac
done
@zgulde
zgulde / git.md
Last active October 25, 2017 19:36

Arrays Review

Given the following code:

var myArray = [1, 2, 3, 4, 5];
  1. What is the element at index 0?