Notes taken while experimenting with Vapor (version 3.0, Feb 2019) using docker to run a vapor server and PostgreSQL.
This file contains 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
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "C/C++: clang++ build and debug active file", | |
"type": "cppdbg", | |
"request": "launch", |
This file contains 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
require 'objspace' | |
def self.show_allocations(&block) | |
_ = ObjectSpace.trace_object_allocations &block | |
ObjectSpace | |
.each_object | |
.to_a | |
.filter_map do |obj| | |
file = ObjectSpace.allocation_sourcefile obj | |
line = ObjectSpace.allocation_sourceline obj |
This file contains 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,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
This file contains 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
#!python2 | |
import sys | |
import codecs | |
name_in = sys.argv[1] | |
name_out = sys.argv[2] | |
with open(name_in, "rb") as input: | |
data = input.read() |
-
Create a file to store our credentials:
sudo vim /etc/postfix/sasl_passwd
-
Add something like this:
This file contains 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
{ | |
// Editor font | |
"editor.fontFamily": "Source Code Pro, Menlo, monospace", | |
"editor.fontSize": 13, | |
"editor.fontLigatures": true | |
} |
This file contains 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
# include in your ~/.ssh/config file | |
Host * | |
AddKeysToAgent yes | |
UseKeychain yes | |
IdentityFile ~/.ssh/your-private-key |
This file contains 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 JSON to YAML | |
# Requires: PyYAML | |
alias json2yaml="python -c 'import json;import yaml;import sys;print(yaml.dump(json.load(sys.stdin), default_flow_style=False))'" | |
# Usage: | |
curl example.com/whatever.json | json2yaml |
This file contains 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 centos:6 | |
ENV PYTHON_VERSION "3.6.0" | |
RUN yum install -y gcc make zlib-devel openssl-devel sqlite-devel bzip2-devel \ | |
&& curl -O https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz \ | |
&& tar xvf Python-${PYTHON_VERSION}.tgz \ | |
&& cd Python-${PYTHON_VERSION} \ | |
&& ./configure --prefix=/usr/local \ | |
&& make \ |
NewerOlder