Skip to content

Instantly share code, notes, and snippets.

View onnimonni's full-sized avatar

Onni Hakala onnimonni

View GitHub Profile
server {
listen 443 http2 ssl;
server_name konesola.22.fi;
ssl_certificate /etc/letsencrypt/live/somedomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/somedomain.com/privkey.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-XSS-Protection 0 always;
add_header X-Content-Type-Options nosniff always;
@lamyj
lamyj / start_gpg_agent
Created January 7, 2017 09:07
Start gpg-agent on macOS
#!/usr/bin/env python
import os
import re
import subprocess
import sys
def main():
# If necessary, run gpg-agent
if not is_running():
@soderlind
soderlind / wp.media.view.Modal.prototype.on.open.js
Created February 22, 2016 16:57
wp.media.view.Modal.prototype.on('open', function() {});
jQuery(document).ready(function($){
if (wp.media) {
wp.media.view.Modal.prototype.on('open', function() {
console.log('media modal open');
});
}
});
@onnimonni
onnimonni / sendmail
Last active May 29, 2017 19:33
msmtp wrapper which acts like sendmail and reads configs from envs. Useful in php docker containers to ensure that all mail() calls are working.
#!/bin/bash
##
# This is custom wrapper for msmtp which acts like good old sendmail
# - It is used for php and cron
# - This is easier to configure for external mail server than sendmail
# - sendmail is just the default binary which other services will use
# - It needs following env: SMTP_HOST, SMTP_PASSWORD, SMTP_PORT, SMTP_AUTH, SMTP_USER
##
# This script gives itself as a parameter for msmtp
@dustingetz
dustingetz / serve.py
Last active August 14, 2019 18:14 — forked from rca/serve.py
serve static assets for frontend development, with http headers to disable caching
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
@japsu
japsu / ehdotus.md
Last active December 1, 2021 08:24
Sähköauton lataus taloyhtiössä

Sähköauton lataus taloyhtiössä

Esitys yhtiökokoukselle

Taustaa

Sähköautot ovat vielä toistaiseksi harvinaisia, mutta niiden osuus autokannasta kasvaa koko ajan. Valtioneuvoston tavoitteena on, että vuonna 2030 Suomessa olisi 250 000 täyssähköautoa ja lataushybridiä, kun vuoden 2018 lopussa liikennekäytössä oli 2 404 täyssähköautoa ja 13 095 lataushybridiä.

Sähköauton latauksen järjestäminen on yksi keskeisimpiä kysymyksiä sähköauton hankintaa pohtivalle. Sähköauton kotilatauksen toteuttaminen sähkö- ja paloturvallisella tavalla edellyttää lataukseen tarkoitetun suojatun pistorasian tai kiinteän latausaseman asennusta. Lisäksi sähköauton latauksessa taloyhtiössä on huomioitava osakkaiden yhdenvertaisuus.

@JoeUX
JoeUX / compile-nginx.sh
Last active March 5, 2022 18:36 — forked from tollmanz/compile-nginx.sh
Optimized nginx compilation flags for modern CPUs, faster math, and LTO. This should be much faster than vanilla nginx builds. Still testing.
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN. I updated this block to get the latest 1.0.2h release. It's critical that OpenSSL be up to date.
@bjornjohansen
bjornjohansen / run-wp-cron.sh
Last active September 17, 2023 21:12
Run all due cron events for WordPress with WP-CLI. Works with both single sites and multisite networks.
#!/bin/bash
# Copyright © 2015 Bjørn Johansen
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
WP_PATH="/path/to/wp"
# Check if WP-CLI is available
if ! hash wp 2>/dev/null; then
@andyshinn
andyshinn / Dockerfile
Created December 24, 2015 19:07
BusyBox cron container example
FROM gliderlabs/alpine:3.3
COPY myawesomescript /bin/myawesomescript
COPY root /var/spool/cron/crontabs/root
RUN chmod +x /bin/myawesomescript
CMD crond -l 2 -f
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.