Skip to content

Instantly share code, notes, and snippets.

[1553865680484] [DEBUG] 2019-03-29T13:21:20.484Z 2bb42696-353d-430c-b80c-3fb8dfeda4a5 Zappa Event: {'resource': '/', 'path': '/', 'httpMethod': 'GET', 'headers': {'Accept-Encoding': 'gzip', 'Cache-Control': 'no-cache', 'CloudFront-Forwarded-Proto': 'https', 'CloudFront-Is-Desktop-Viewer': 'true', 'CloudFront-Is-Mobile-Viewer': 'false', 'CloudFront-Is-SmartTV-Viewer': 'false', 'CloudFront-Is-Tablet-Viewer': 'false', 'CloudFront-Viewer-Country': 'GB', 'dnt': '1', 'Host': '779vtjqci6.execute-api.eu-west-2.amazonaws.com', 'Pragma': 'no-cache', 'upgrade-insecure-requests': '1', 'User-Agent': 'Amazon CloudFront', 'Via': '1.1 fca1185b8960af4f3672f61581dfdaec.cloudfront.net (CloudFront), 1.1 0210db6188ed379f1f743c3f6a29a1eb.cloudfront.net (CloudFront)', 'X-Amz-Cf-Id': '50QTTxIJiDxAD11bZ6RhvhH31dt7Nx54Q7yUMx6iac_JDO--1TImvw==', 'X-Amzn-Trace-Id': 'Root=1-5c9e1bd0-01510edf90eb55775987ab94', 'X-API-Key': 'O4AsXjaYuchD7MwPgQtKWLiAQPKaChHmixDs6c00', 'X-Forwarded-For': '78.32.251.194, 52.56.127.66, 70.132.20.141', 'X-Forwa
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = delme_from_dict(json.loads(json_string))
from typing import Optional, Any, List, Dict, Union, TypeVar, Callable, Type, cast
tobias@tobias:kimai (master) $ sudo openvpn ~/etc/vpn/neontribe2.ovpn
[sudo] password for tobias:
Fri Dec 21 10:37:16 2018 OpenVPN 2.4.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Sep 5 2018
Fri Dec 21 10:37:16 2018 library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.08
Enter Auth Username: tobias
Enter Auth Password: *******
Fri Dec 21 10:37:21 2018 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Fri Dec 21 10:37:21 2018 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Fri Dec 21 10:37:21 2018 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Fri Dec 21 10:37:21 2018 TCP/UDP: Preserving recently used remote address: [AF_INET]217.35.80.79:24006
<?php
$nids = \Drupal::entityQuery('node')->condition('type','entry')->execute();
$nodes = \Drupal\node\Entity\Node::loadMultiple($nids);
echo "Found ";
print_r(count($nodes));
echo " nodes.\n";
foreach ($nodes as $node) {
@tobybatch
tobybatch / gist:f7ebb0c94feb88c3da27f101a768e35b
Created October 8, 2018 16:34 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@tobybatch
tobybatch / nginx config
Created September 5, 2018 14:20
Crowdsourced nginx conf, it is the product from running https://github.com/jwilder/nginx-proxy
# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
default $http_x_forwarded_proto;
'' $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
default $http_x_forwarded_port;
@tobybatch
tobybatch / pre-commit
Last active October 26, 2018 08:18
Pre commit hook to encrypt sensetive files
#!/bin/bash
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_GREEN=$ESC_SEQ"32;01m"
COL_YELLOW=$ESC_SEQ"33;01m"
COL_BLUE=$ESC_SEQ"34;01m"
COL_MAGENTA=$ESC_SEQ"35;01m"
COL_CYAN=$ESC_SEQ"36;01m"
@tobybatch
tobybatch / gist:b4ad86d635760c545e8ab693187e44d5
Created July 30, 2018 12:59
Setting new certs in a JKS
Define the certs, stores and domain name
export KEYSTORE=/etc/ssl/certs/java/jira.jks
export CERT=cert.pem
export CERTBUNDLE=fullchain.pem
export DOMAINNAME=jira.neontribe.org
export INKEY=privkey.pem
View exsiitng aliases and remove the root cert bundles
@tobybatch
tobybatch / ansible-summary.md
Created February 22, 2018 09:48 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

openssl s_client -connect localhost:443 -showcerts