Skip to content

Instantly share code, notes, and snippets.

View onnimonni's full-sized avatar

Onni Hakala onnimonni

View GitHub Profile
@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.

@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
@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():
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;
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active April 19, 2024 16:03
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@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.
@ralphschindler
ralphschindler / README.md
Last active September 30, 2023 19:28
Docker For Mac Host Address Alias To Enable PHP XDebug (10.254.254.254 Trick)

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254.

Once your machine has a well known IP address, your PHP container will then be able to connect to it, specifically XDebug can connect to it at the configured xdebug.remote_host.

Installation Of IP Alias (This survives reboot)

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

@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');
});
}
});
@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
@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