Skip to content

Instantly share code, notes, and snippets.

View picklepete's full-sized avatar

Peter Evans picklepete

View GitHub Profile
#import necessary libraries
import cv2
import numpy as np
#capture video from the webcam
cap = cv2.VideoCapture(0)
#load the face finder
face_cascade = cv2.CascadeClassifier('/home/sm/Desktop/haarcascade_frontalface_default.xml')
@plentz
plentz / nginx.conf
Last active July 15, 2024 17:46
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@rgreenjr
rgreenjr / postgres_config.md
Last active June 4, 2024 09:36
PostgreSQL Configuration Optimization

PostgreSQL Configuration Optimization

Memory

Only four values really matter:

  • shared-buffers: below 2GB: set it to 20% of full memory; below 32GB: 25% of your full memory.
@noonien
noonien / evil
Created July 19, 2012 12:07
Simple bash prank
# This script disables execution of commands and echoes messages to the user, to disable type: "wat"
#
# To install this, you need to have access to the user's home directory.
# sudo -u <user> -i sh -c 'cp /path/to/evil ~/.evil && cp ~/.bashrc ~/.bashrc.ebak && echo ". ~/.evil" >> ~/.bashrc'
shopt -s extdebug
function disable_evil() {
rm ~/.evil
rm ~/.bashrc
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@p01
p01 / LICENSE.txt
Last active May 23, 2024 13:46 — forked from 140bytes/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@aemkei
aemkei / LICENSE.txt
Created August 22, 2011 19:06 — forked from 140bytes/LICENSE.txt
Latitude Longitude Distance - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@dave1010
dave1010 / 00-the-wordpress-way.md
Created August 18, 2011 09:21
The WordPress Way - The 10 rules of WordPress development

The WordPress Way

A tongue-in-cheek look at coding standards in the WordPress core and the average WordPress plugin.

  1. # Declare variables global - in case they're going to be used again
  2. All function/method parameters should be strings (e.g. 'yes'/'no') - for clarity
  3. Functions and methods should return mixed types
  4. No need to separate PHP logic from HTML, JS or CSS
  5. Don't worry about PHP Notices - they're not important
@dave1010
dave1010 / HtmlNode.php
Created August 9, 2011 14:02
HtmlNode.php - generate HTML from PHP
<?php
/**
* Quick and dirty HTML generation for PHP
*/
class HtmlNode {
public $element = 'div';
public $content = null;
public $attrs = array();
public function __construct($element=null, $content=null, $attrs=null, $closing=null, $shortclosing=' /') {