Skip to content

Instantly share code, notes, and snippets.

View rossanthony's full-sized avatar

Ross Anthony rossanthony

  • Birkbeck, University of London
  • Detroit, USA
View GitHub Profile
@rossanthony
rossanthony / launch.json
Created June 22, 2020 21:45
vscode debugger setup...
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach debug inspector to Docker",
"trace": "verbose",
"port": 9229,
@rossanthony
rossanthony / gist:81251598eb32967e2b6feb19c165b9a5
Created May 8, 2017 13:21
ES date histogram aggregations query results
{
"total": 5,
"dateRange": {
"from": "2017-05-08T00:00:00Z",
"to": "2017-05-08T23:59:59Z"
},
"aggregations": {
"views": {
"buckets": [
{
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend();
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});

Listing all process swap space usage

Type the following bash for loop command to see swap space usage per process:

for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less

{
"status": "OK",
"data": [
{
"_1": {
"id": 1,
"flightNumber": 123,
"airlineId": 216,
"departureAirportId": 2013,
"departureDay": 3,
ab -n100 -c10 http://acknowledgement.uk:80/
Benchmarking acknowledgement.uk (be patient).....done
Server Software: Apache/2.2.15
Server Hostname: acknowledgement.uk
Server Port: 80
Document Path: /
Document Length: 15612 bytes
# Setting up nginx and node
Nginx
Any non-dynamic content should be served by Nginx since there is
no logic needed and it is something Nginx is great at, so why have
Node do it? The snippet below configures Nginx to listen on port 80
and serve static files from the web root. Each request is checked
to see if it's a POST or any other method with a JSON request type.