Skip to content

Instantly share code, notes, and snippets.

View th3hunt's full-sized avatar
🎯
Focusing

Stratos Pavlakis th3hunt

🎯
Focusing
  • Blueground
  • Athens
View GitHub Profile
@th3hunt
th3hunt / postgres-cheatsheet.md
Created January 3, 2019 13:52 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@th3hunt
th3hunt / Dockerfile
Last active October 31, 2018 08:37
Sample Dockerfile
FROM node:8-alpine
EXPOSE 3000
ARG NODE_ENV
ENV NODE_ENV $NODE_ENV
RUN apk add --update curl && rm -rf /var/cache/apk/*
RUN mkdir /app
@th3hunt
th3hunt / pan.js
Last active August 19, 2020 08:14
Pan gesture helpers
/**
* Pan
* ---
*
* A collection one-finger Pan gesture recognizers.
*
* A pan is an omnidirectional one- or two-finger gesture that expands the field of view.
* Drag is typically used with pan.
*
*/
@th3hunt
th3hunt / aws-ecs-deploy-permissions.md
Created October 3, 2018 15:16 — forked from duluca/aws-ecs-deploy-permissions.md
npm scripts for AWS ECS (Blue-Green Deployment)

AWS ECS Deploy Permissions

In order to be able to deploy using the scripts provided by npm scripts for AWS ECS make sure your user is part of an IAM Group that has the following inline policy applied to it.

Note: This may not be complete.

{
    "Version": "2012-10-17",
    "Statement": [
@th3hunt
th3hunt / node-folder-structure-options.md
Created September 19, 2018 10:50 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@th3hunt
th3hunt / nodejs-cluster-zero-downtime.md
Created September 19, 2018 09:42 — forked from jedi4ever/nodejs-cluster-zero-downtime.md
nodejs clustering, zero downtime deployment solutions

Clustering: The basics

The trick? pass the file descriptor from a parent process and have the server.listen reuse that descriptor. So multiprocess in their own memory space (but with ENV shared usually)

It does not balance, it leaves it to the kernel.

In the last nodejs > 0.8 there is a cluster module (functional although marked experimental)

@th3hunt
th3hunt / dd.js
Last active March 28, 2018 10:29
Dummy data + Flood storage
/**
* dd (aka dummy data)
* -------------------
*
* Generate dummy data in the form of a String
*
* @param {object} options
* @param {number} [options.sizeInKB=0] - the size of the String in KB, if specified `sizeInMB` is ignored
* @param {number} [options.sizeInMB=1] - the size of the String in MB
* @returns {string} a random string of the specified size
@th3hunt
th3hunt / what-forces-layout.md
Created February 22, 2018 16:37 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@th3hunt
th3hunt / package.json.js
Created September 13, 2017 15:33 — forked from MoOx/package.json.js
Boost your Webpack performance with DLLPlugin (will bundle as dll all your "dependencies", see comment in package.json)
{
"private": true,
// ...
"#dependencies": "dependencies are the one shipped to the client",
"dependencies": {
"babel-polyfill": "^6.7.4",
"react": "^15.0.0",
// ...
"whatwg-fetch": "^0.11.1"
},
@th3hunt
th3hunt / .loginhook
Last active July 19, 2017 13:41
Jenkins LaunchAgent on OS X for user Hudson
#!/bin/bash
# Hook that runs right after login by loginhook.plist LaunchAgent
# Place in $HOME/.loginhook
# chmod 700 .loginhook
# Ignore "control-C" or any other signals that might try to prevent this script from running
trap '' 1 2 3 6 14 15
# Lock the screen so that password is required again
(sleep 1; exec "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession" -suspend)