Skip to content

Instantly share code, notes, and snippets.

View vnglst's full-sized avatar
💭
Building 🪲

Koen van Gilst vnglst

💭
Building 🪲
View GitHub Profile
@vnglst
vnglst / pdf.js
Last active November 4, 2016 12:51
const express = require('express')
const router = express.Router()
const PDFDocument = require('pdfkit')
router.post('/', (req, res) => {
const doc = new PDFDocument()
let filename = req.body.filename
// Stripping special characters
filename = encodeURIComponent(filename) + '.pdf'
// Setting response to 'attachment' (download).
@vnglst
vnglst / layout.pug
Last active November 3, 2016 14:32
doctype html
html
head
title= title
link(rel='stylesheet', href='https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/flatly/bootstrap.min.css')
link(rel='stylesheet', href='/stylesheets/style.css')
body
block content
extends layout
block content
.row
.col-md-8
h1="Create a PDF"
form.form-horizontal.well(method="post", action="/pdf")
.form-group
label.col-md-2.control-label File Name
.col-md-10
.input-group
@vnglst
vnglst / pdf_merge.sh
Last active May 16, 2016 15:28
OSX script to merge PDF's
function pdf_merge {
join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
read "output_file?Name of output file > "
"$join_py" -o $output_file $@ && open $output_file
}
@vnglst
vnglst / osx_pdf_join.sh
Created May 16, 2016 15:16 — forked from anthonywu/osx_pdf_join.sh
Mac OS X – bash function to join pdfs on the command line
function pdf_join {
join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
read -p "Name of output file > " output_file && "$join_py" -o $output_file $@ && open $output_file
}
$ sudo apt-get install avahi-daemon
$ sudo apt-get install avahi-utils
$ avahi-browse --all --resolve
beter nog
$ avahi-browse --all --resolve -t”
dan stopt die wat eerder
@vnglst
vnglst / crontab
Last active February 23, 2016 15:04
Crontab file on Macbook for OverheidsEdits Twitter bot
MAILTO=xxxx@xxxx.de
PATH=$PATH:/usr/local/bin/
*/5 * * * * /usr/local/bin/isTermUp.sh
@reboot /usr/local/bin/forever -c /usr/local/bin/coffee ~/node/overheid/anon.coffee >> ~/node/log/overheid.log
0 12 * * * /bin/cat ~/node/log/overheid.log | /usr/bin/mail -s "OverheidsEdits Tweets Report" xxx@xxx.de
@vnglst
vnglst / Monitor website up
Last active February 23, 2016 14:21
Crontab script to monitor if website is still up
#!/bin/bash
if [[ `wget -q -O - https://terms.vangilst.eu/duits-nederlands/Biomonitoring | /usr/bin/grep "biologische monitoring"` == "" ]]; then /bin/echo "Website down" | /usr/bin/mail -s "terms.vangilst.eu down!" xxx@xxx.de; fi
# Upstart service for term.world node application
# Save in /etc/init/termworld.conf
description "Term.world node js application"
author "Koen van Gilst"
start on filesystem or runlevel [2345]
stop on shutdown or on runlevel [016]
setuid caddy
@vnglst
vnglst / Unix directory structure
Last active February 15, 2016 11:02
Unix general
├── bin binaries with fundamental utilities like cp, ls etc
├── boot all files required for succesfull booting process
├── dev = "devices" and contains a file representation of all devices
├── etc system-wide configuration files
├── init contains upstart scripts
├── home home directories users
├── lib shared libraries for programs in /bin
├── lib64 see above, for 64 architecture
├── lost+found lost and potentially corrupt files