Skip to content

Instantly share code, notes, and snippets.

🔥
In case of fire: git commit, git push, leave the building!

Dalibor Gogic daliborgogic

🔥
In case of fire: git commit, git push, leave the building!
Block or report user

Report or block daliborgogic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daliborgogic
daliborgogic / localhost.sh
Created Sep 9, 2019
The simplest way to generate a private key and self-signed certificate for localhost.
View localhost.sh
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
@daliborgogic
daliborgogic / .aliases
Last active Sep 10, 2019
DNS over HTTPS (DoH) in Google Chrome
View .aliases
# Google Chrome
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
alias chromedoh='chrome --enable-features="dns-over-https<DoHTrial" --force-fieldtrials="DoHTrial/Group1" --force-fieldtrial-params="DoHTrial.Group1:server/https%3A%2F%2F1.1.1.1%2Fdns-query/method/POST"'
@daliborgogic
daliborgogic / Dockerfile
Last active Sep 11, 2019
Best-Practice Docker Image and GitHub Workflow for Node.js app. [Continuous Integration/Delivery/Deployment]
View Dockerfile
ARG VERSION=12.10.0
# Development ##################################################################
FROM mhart/alpine-node:${VERSION} AS dev
WORKDIR /app
COPY package*.json .gitignore ./
ENV HOST=0.0.0.0
ENV PORT=${PORT}
RUN npm ci --prefer-offline
COPY . .
View Dockerfile
FROM mhart/alpine-node:12.9.1
RUN npm i -g pkg
RUN which pkg
COPY package*.json /app/
RUN cd /app; npm ci \
&& npm run build \
&& /usr/bin/pkg -t node12-linux --output .dist .
COPY . /app
View ecosystem.config.js
module.exports = {
apps : [{
name: 'API',
script: 'app.js',
// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
args: 'one two',
instances: 1,
autorestart: true,
watch: false,
View keybase.md

Keybase proof

I hereby claim:

  • I am daliborgogic on github.
  • I am dlbr (https://keybase.io/dlbr) on keybase.
  • I have a public key ASBRbZLsoxpOQgpE9-Slx-iBxx2x4vVxXNUWq8ie_F2iUAo

To claim this, I am signing this object:

@daliborgogic
daliborgogic / awss3deleteolderthan.sh
Last active Jul 18, 2019
Delete files older than n in S3
View awss3deleteolderthan.sh
#!/bin/bash
# Usage: . ./awss3deleteolderthan.sh [bucket] [path] "20 minutes ago"
endpoint="https://ams3.digitaloceanspaces.com"
aws s3 ls s3://$1/$2 --endpoint $endpoint --recursive | while read -r line;
do
createDate=`echo $line|awk {'print $1" "$2'}`
createDate=`date -d"$createDate" +%s`
@daliborgogic
daliborgogic / crontab
Last active Jul 18, 2019
Syncs directories and S3 prefixes. Recursively copies new and updated files from the source directory to the destination.
View crontab
*/10 * * * * /home/dlbr/documents/scripts/s3sync.sh >> /home/dlbr/documents/logs/s3sync.log 2>&1
@daliborgogic
daliborgogic / project.sh
Last active Jul 16, 2019
Project Folder Structure
View project.sh
#!/bin/bash
# Project Folder Structure
# /project_name
# /assets
# /fonts
# /img
# /source
# /.git
# index.js
# package.json
View regions.js
export default [
['Region Hovedstaden', [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]],
['Region Sjælland', [40,41,42,43,44,45,46,47,48,49]],
['Region Syddanmark', [50,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,70,71,72,73]],
['Region Midtjylland', [74,75,76,78,80,82,,83,84,85,86,88,89]],
['Region Nordjylland', [77,79,90,92,93,94,95,96,97,98,99]],
['Grønland', [39]]
]
You can’t perform that action at this time.