Skip to content

Instantly share code, notes, and snippets.

View detj's full-sized avatar
🖥️
deep into work

Debjeet Biswas detj

🖥️
deep into work
View GitHub Profile
@detj
detj / elasticsearch.conf
Last active May 31, 2016 19:56
Elasticsearch Upstart Configuration
# Elasticsearch Upstart Script
description "Elasticsearch upstart script"
start on (net-device-up
and local-filesystems
and runlevel [2345]
and startup)
stop on runlevel [016]
@detj
detj / run-gitlab-runner-docker.sh
Created June 5, 2016 13:43
Run Gitlab Runner Docker container
#!/bin/bash
docker run -d --name gitlab-runner --restart always \
-v /data/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:lates
@detj
detj / run-gitlab-docker.sh
Created June 5, 2016 13:46
Run Gitlab Docker Container
#!/bin/bash
# Replace hostname
HOSTNAME=[HOSTNAME HERE]
docker run --detach \
--hostname $HOSTNAME \
--publish 443:443 --publish 80:80 --publish 22:22 --publish 9418:9418 \
--name gitlab \
--restart always \
@detj
detj / diffie-hellman
Created July 8, 2016 11:09
Generate Diffie Hellman Keys
openssl dhparam -out dhparam.pem 4096
@detj
detj / robots.txt
Last active August 17, 2016 10:50
robots.txt nginx config in one line
#Allow access to all User-agents:
location /robots.txt {return 200 "User-agent: *\nDisallow:\n";}
#Disallow access to every User-agent:
location /robots.txt {return 200 "User-agent: *\nDisallow: /\n";}
@detj
detj / app.js
Created August 18, 2016 11:43 — forked from Ajido/app.js
nodejs express4 cluster graceful restart / shutdown
...
app.use(function(req, res, next){
if (app.get('graceful_shutdown') === true) {
res.set('Connection', 'close');
}
next();
});
app.set('graceful_shutdown_start', function() {
@detj
detj / grep-up-down.sh
Created August 27, 2016 13:23
Grab bunch of lines before & after certain keyword
# grab 10 lines before & after the pattern
# make sure escape sequences are reained so it looks pretty (that's what the -r flag is for in less)
grep -B 10 -A 10 "error" file.log | less -r
@detj
detj / mac-wifi-pass.sh
Last active February 15, 2019 19:48
get wifi password
security find-generic-password -ga "SSID"
@detj
detj / forward-proxy.js
Last active November 12, 2020 13:31
Forward proxy in Express
const http = require("http");
const express = require("express");
const app = express();
const HOST = "localhost";
const PORT = 4000;
const PROXY_PORT = 8080;
setupProxy();
@detj
detj / exclude-one.js
Created October 24, 2019 09:26
return a new object excluding one key
const source = { a: 1, b: 2, c: 3 }
const toRemove = "c"
const { [toRemove]: toRemove, ...rest } = source
// rest will be { a: 1, b: 2 }
// source remains { a: 1, b: 2, c: 3}