Skip to content

Instantly share code, notes, and snippets.

View judges119's full-sized avatar

Az Vera judges119

View GitHub Profile
@judges119
judges119 / search.py
Last active January 16, 2020 00:07
Simple search scraper
from celery import Celery
from elasticsearch import Elasticsearch
import json
from lxml import html
import redis
import requests
import sys
from urllib.parse import urlparse, urlunparse
SITE = 'https://adamogrady.id.au/'
@judges119
judges119 / index.js
Created September 4, 2017 14:46
Basic multer uploads
var express = require('express');
var multer = require('multer');
var upload = multer({ dest: 'uploads/' });
var app = express();
// View engine
app.set('views', __dirname);
app.set('view engine', 'pug');
// Routes
@judges119
judges119 / split_json.py
Created August 31, 2017 01:51
Split JSON object file by key
import json
with open('file.json') as data_file:
data = json.load(data_file)
for key in data:
f = open(''.join([key, '.json']), 'w')
d = {key:data[key]}
f.write(json.dumps(d))
f.close()
@judges119
judges119 / gzip.vcl
Last active August 31, 2017 01:49
Varnish - enable gzip on SVG files
# in vcl_backend_response
if (beresp.http.content-type ~ "^(image/svg|image/svg\+xml|image/svg+xml)$")
{
set beresp.do_gzip = true;
}
@judges119
judges119 / new-tumblr.html
Last active July 8, 2016 05:54
My Tumblr theme: http://blog.adamogrady.id.au/ consider all of the design MIT licensed except for the Special Elite font used for headers (which is Apache licensed via Google Fonts).
<!DOCTYPE html>
<html>
<head>
<title>{Title}{block:PostSummary} - {PostSummary}{/block:PostSummary}</title>
<link rel="shortcut icon" href="{Favicon}">
<link rel="alternate" type="application/rss+xml" href="{RSS}">
{block:Description}
<meta name="description" content="{MetaDescription}" />
{/block:Description}

Keybase proof

I hereby claim:

  • I am judges119 on github.
  • I am adamjogrady (https://keybase.io/adamjogrady) on keybase.
  • I have a public key whose fingerprint is 7FFF 2587 A9DB 6714 FDA7 CBDC AA53 068F 3125 2FF2

To claim this, I am signing this object:

@judges119
judges119 / removetension.md
Last active January 28, 2016 13:25
Reminder to release tension

Friendly reminder to check you’re not holding tension in your body.

  1. Let your shoulders drop
  2. Unclench your hands and jaw
  3. Take a deep breath.

Much better.

@judges119
judges119 / hampel.js
Last active November 10, 2020 18:12
JS Hampel Filter
/*
Hampel Filter implemented in JavaScript by Adam O'Grady
AN: Very basic (ie: improve before using in production) function I needed for some work stuff, used for detecting and removing outliers in a moving window via Median Absolute Deviation (MAD)
PARAMS:
data - Array of numbers to be examined
half_window: Integer representing half the moving window size to use
threshold: Integer for the maximum multiple of the Median Absolute Deviation before it's considered an outlier and replaced with the median
RETURNS:
object:
data: updated, smoothed array