Skip to content

Instantly share code, notes, and snippets.

View pedrohenriquebr's full-sized avatar
💻
Home office

Pedro Braga pedrohenriquebr

💻
Home office
  • Rio de Janeiro, Brazil
View GitHub Profile
@paulness
paulness / post_install.sh
Last active September 27, 2020 23:48 — forked from KingsleyOmon-Edo/post_install.sh
Ubuntu post installation script for installing software of your choice.
#!/bin/bash
curl_check ()
{
echo "Checking for curl..."
if command -v curl > /dev/null; then
echo "Detected curl..."
else
echo "Installing curl..."
apt-get install -q -y curl

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

#!/usr/bin/python
# A testing implementation of binary trees
# Very primitive (key = value, no duplicates, only integers)
# http://www.algolist.net/Data_structures/Binary_search_tree/Insertion
# http://stackoverflow.com/questions/2598437/how-to-implement-a-binary-tree-in-
class Node:
def __init__(self, val):
self.l = None
self.r = None
@gokulkrishh
gokulkrishh / media-query.css
Last active December 2, 2025 07:44
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@richardkundl
richardkundl / drop-tables.sql
Last active March 14, 2023 20:04
Drop all tables in a SQL Server database (Azure Friendly!)
-- original source: http://edspencer.me.uk/2013/02/25/drop-all-tables-in-a-sql-server-database-azure-friendly/
-- drop all constraint
while(exists(select 1 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_TYPE='FOREIGN KEY'))
begin
declare @sql1 nvarchar(2000)
SELECT TOP 1 @sql1=('ALTER TABLE ' + TABLE_SCHEMA + '.[' + TABLE_NAME
+ '] DROP CONSTRAINT [' + CONSTRAINT_NAME + ']')
FROM information_schema.table_constraints
WHERE CONSTRAINT_TYPE = 'FOREIGN KEY'
@kbambz
kbambz / postactivate-env-setup
Last active July 28, 2018 16:53
virtualenvwrapper postactivate and predeactivate scripts to export all a .env file's declarations (foreman style) into your bash environment on activate, then clean them up on deactivate. Also tells npm and rvm to install packages directly into the active virtualenv. Useful for Heroku-hosted project development.
#!/bin/bash
# This hook should be run after every virtualenv is activated.
# See `predeactivate-env-cleanup` to configure automatic clean-up.
#
# INSTALLATION
# Save the latest version of this file into your virtualenvwrapper
# hook directory (e.g., ~/.virtualenvs):
# $ echo "$(curl -fsSl https://gist.githubusercontent.com/kbambz/10002069/raw/postactivate-env-setup)" > $VIRTUALENVWRAPPER_HOOK_DIR/postactivate-env-setup
#
# Then tell postactivate to invoke the script when it runs:
@bcomnes
bcomnes / redshift.conf
Created December 9, 2012 07:35
My configuration file for Redshift. Place it in ~/.config/ Drag redshift onto the Startup Applications menu to have it boot on start
; Global settings
[redshift]
temp-day=6500K
temp-night=5000
transition=1
;gamma=0.8:0.7:0.8
gamma=1.000:1.000:1.000
location-provider=geoclue
;location-provider=manual
adjustment-method=vidmode
@hanleybrand
hanleybrand / requests_image.py
Created December 6, 2012 03:56
Download images with Requests: HTTP for Humans
import requests
from io import open as iopen
from urlparse import urlsplit
def requests_image(file_url):
suffix_list = ['jpg', 'gif', 'png', 'tif', 'svg',]
file_name = urlsplit(file_url)[2].split('/')[-1]
file_suffix = file_name.split('.')[1]
i = requests.get(file_url)
if file_suffix in suffix_list and i.status_code == requests.codes.ok: