Skip to content

Instantly share code, notes, and snippets.

View nickodell's full-sized avatar

Nick ODell nickodell

  • Fort Collins, CO
View GitHub Profile
// ==UserScript==
// @name Remove Search Pulsing
// @version 1
// @grant none
// @match https://stackoverflow.com/*
// ==/UserScript==
(new MutationObserver(check)).observe(document, {childList: true, subtree: true});
@nickodell
nickodell / filter.py
Created October 30, 2022 01:36
filter tennis court
import numpy as np
import cv2
import scipy.ndimage
import matplotlib.pyplot as plt
img = cv2.imread('HjJto.jpg')
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
blue = np.array((81, 93, 147)).reshape(1, 1, 3)
rmse = np.sqrt(((img_rgb - blue)**2).mean(axis=2))
concatenated = data[['day', 'month', 'year', 'time']].astype(str).agg(' '.join, axis=1)
data['date'] = pd.to_datetime(concatenated)
user www-data;
worker_processes auto;
pid /run/nginx/nginx.pid; # only line changed from default
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}

Installing Python 3.6.8 on Raspbian

As of March 2018, Raspbian does not yet include the latest Python release, Python 3.6.8 This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).

Here's a guide about when and how to use prepared statements.

Why bother with prepared statements?

The first reason to use a prepared statement is to protect against SQL injections.

You can do this by removing all special characters, but there are times when that's not practical. (Example: you want to allow users who have apostrophes in their names to register for your website.) You can do it by escaping all of the strings that you pass into the SQL query, but it's easy to forget to sanitize a single field.

So how do you protect against SQL injection? Here is the simple way to never fall prey to SQL injection: never put a user-provided string into an SQL query, except as a parameter to a prepared statement.

@nickodell
nickodell / build-debian.md
Last active February 22, 2018 23:56
Building libfive on Debian 9 (WIP)

Introduction

This is a guide to install libfive. libfive is a very unfinished program that allows you to model volumes. In other words, you can give libfive a functional representation of a solid, and libfive will figure everything else out, and render the resulting mesh. Pretty cool.

Example

Conventions used by this document: # indicates a command run by root, and $ indicates user.

@nickodell
nickodell / point.py
Last active April 30, 2021 04:35 — forked from hirokai/point.py
2D Point class in Python
#!/usr/bin/env python3
from math import sqrt
class Point:
def __init__(self,x_init,y_init):
self.x = x_init
self.y = y_init
def shift(self, x, y):
@nickodell
nickodell / install-apt-cacher.sh
Last active March 31, 2016 04:37
install-apt-cacher.sh
echo "Acquire::http::Proxy \"http://apt-cacher:3142\";" > /etc/apt/apt.conf.d/01proxy
@nickodell
nickodell / debug.log
Created November 4, 2015 21:19
bawejakunal log
This file has been truncated, but you can view the full file.
2015-11-03 22:05:38