Skip to content

Instantly share code, notes, and snippets.

View thpham's full-sized avatar

Thomas Kim Pham thpham

View GitHub Profile
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123
To get started with Docker/Marathon/Mesos, you need to install a
new Mesos, a new Marathon, and Deimos, the bridge to Docker.
You'll also need Docker and the JVM. These instructions are for
Ubuntu 13.10.
## Install Mesos prerequisites
:; sudo apt-get update
:; sudo apt-get install zookeeperd default-jre python-setuptools python-protobuf curl pip
## Install recent Mesos
@yaronr
yaronr / bootstrap-consul.sh
Last active September 27, 2020 17:54
Bootstrap Consul on CoreOS
#!/bin/bash
source /etc/environment
hostname=$(cat /etc/machine-id)
machines=$(etcdctl ls /consul.io/bootstrap/machines)
#If there are 'machines' then the cluster has been initialised.
if [ -z "$machines" ]
then
flags="${flags} -bootstrap"
@joerocklin
joerocklin / safe_reset_haproxy.sh
Created January 6, 2015 21:35
safe haproxy reload
#!/bin/bash
# This checks which ports haproxy currently is listening on, temporarily drops SYN packets
# to prevent new connections, reloads haproxy, then allows SYNs again.
#
# Based on info from here:
# * https://github.com/aws/opsworks-cookbooks/pull/40
# * http://www.mail-archive.com/haproxy@formilux.org/msg06885.html
#set -x
@JohnMorales
JohnMorales / close_docker_files.sh
Last active January 5, 2021 11:43
Closes leaked deleted and eventfd left by docker
#!/bin/bash
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
docker_pid=$(cat /var/run/docker.pid)
gdb -p $docker_pid <<< "$( ls /proc/$docker_pid/fd -l --time-style=+'%s' | grep -E 'deleted' | awk '{ printf("p close(%s)\n", $7)}')" >/dev/null
#closing evenfds that do not have a corresponding memory.oom_control
eventfds="$(for eventfd in $(ls /proc/$docker_pid/fd -l --time-style=+'%s' | grep -E 'eventfd'| awk '{print $7}'); do
memory_pid=$((eventfd - 1))
#!/usr/bin/env python
from xivo_auth_client import Client as Auth
from xivo_confd_client import Client as Confd
auth = Auth('127.0.0.1', username='sylvain', password='sylvain', verify_certificate=False)
token_data = auth.token.new('xivo_user', expiration=10)
token = token_data['token']
uuid = token_data['xivo_user_uuid']

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

# This isn't meant to be ran as a script, but line-by-line
# Props to Binary (benary.org) for helping me with this
# 0: Create a Scaleway instance and SSH into it
ssh root@...
# 1: Install Nix
adduser user # set a password, doesn't matter what because it's not staying long
adduser user sudo
su -l user