Skip to content

Instantly share code, notes, and snippets.

@ndavison
ndavison / nginx-drupal-hhvm.conf
Last active January 3, 2017 00:37
Nginx load balancing configuration for HHVM and Drupal
upstream myapp1 {
server 127.0.0.1:9000;
server 127.0.0.1:9001;
}
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php;
@ndavison
ndavison / socket-https-client.py
Created November 19, 2014 10:03
Python socket HTTPS client connection example
#!/bin/env python
"""
A simple example of using Python sockets for a client HTTPS connection.
"""
import ssl
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('github.com', 443))
@ndavison
ndavison / gist:29708215fd5b4af2f2e2379dd2c24c96
Created April 30, 2017 09:47
GravCMS convert inline JS into sourced file JS
diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php
index 12efc1a..383cd8d 100644
--- a/system/src/Grav/Common/Assets.php
+++ b/system/src/Grav/Common/Assets.php
@@ -678,15 +678,20 @@ class Assets
}
}
- // Render Inline JS
+ // Convert Inline JS into a sourced JS file
@ndavison
ndavison / build.sh
Last active February 28, 2018 01:25
DTA marketplace dev build
#!/bin/bash
#
# Digital Marketplace dev environment build script.
#
# use brew to install the following before running this script:
#
# postgres 9.6.x
# nvm
# cairo
# pango
@ndavison
ndavison / build.sh
Last active February 1, 2019 03:29
DTA marketplace build v2 (bash only)
#!/bin/bash
#
# Digital Marketplace dev environment build script.
#
# use brew to install the following before running this script:
#
# postgres 9.6.x
# nvm
# yarn
# bower
#!/bin/bash
#
# This updates the CF ups-dm-common app's env vars. You need to make sure
# the below JSON encoded object contains *all* the env vars, as this is a
# complete replacement.
#
cf update-user-provided-service ups-dm-common -p @<(cat <<EOF
{
"ENV_VAR_EXAMPLE_1": "xxx",
@ndavison
ndavison / vscode-sqli-search.txt
Created December 12, 2018 23:11
VSCode search for SQLAlchemy functions that might be vulnerable to SQL Injection if used incorrectly
\.(filter|having|distinct|group_by|order_by)\(
?[^\)]+
@ndavison
ndavison / logstash.conf
Last active September 30, 2024 07:16
Cloud.gov.au web log config for logstash
input {
tcp {
port => 5000
}
}
filter {
json {
source => "message"
}
@ndavison
ndavison / circleci.py
Last active February 5, 2020 01:10
Downloads build logs from circleci for a particular project and repo
import requests
import json
import os
from argparse import ArgumentParser
parser = ArgumentParser(description="Downloads build logs from circleci for a particular project and repo.")
parser.add_argument("-p", "--project", help="project and repo to request circleci build logs for, in the format of project/repo")
parser.add_argument("-t", "--token", default=None, help="API token for non public readable builds")
@ndavison
ndavison / travisci.py
Last active September 24, 2022 05:54
Downloads build logs from travisci for a particular project.
import requests
import json
import os
import urllib.parse
from argparse import ArgumentParser
parser = ArgumentParser(description="Downloads build logs from travisci for a particular project.")
parser.add_argument("-p", "--project", help="project to request travisci build logs for")
parser.add_argument("-r", "--repo", default=None, help="repo to request travisci build logs for")