Skip to content

Instantly share code, notes, and snippets.

View duncangh's full-sized avatar
💭
👨‍💻

Graham Duncan duncangh

💭
👨‍💻
View GitHub Profile
@Paulmicha
Paulmicha / Crontab.sh
Last active June 23, 2018 00:36
Command-line / Shell / Bash Scripting - Snippets, Notes & Whatnot
#!/bin/bash
# -*- coding: UTF8 -*-
##
# Command-line / Shell / Bash - snippets : Cron-related snippets
# Tested on Debian 6 ("Squeeze")
#
# Sources :
# https://drupal.org/node/23714
# http://www.linuxquestions.org/questions/linux-general-1/crontab-every-10-minutes-117651/
@chrisbloom7
chrisbloom7 / .bash_aliases
Last active June 23, 2018 00:37
A portion of my alias entries and some other useful snippets for Bash
#!/bin/sh
# GENERAL COMMANDS
alias l='ls -AHhlp'
alias c='clear'
alias cx='chmod +x'
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
alias reload='source ~/.bash_profile'
alias release='xattr -d com.apple.quarantine'
alias flushdns='sudo discoveryutil udnsflushcaches'
@kravik
kravik / detect-face-landmarks.swift
Last active July 18, 2018 22:19
iOS 11 Vision. Face detection
import Vision
//1
let sourceImage = UIImage(named: "jony.jpg")
var resultImage = sourceImage
//2
let detectFaceRequest = VNDetectFaceLandmarksRequest { (request, error) in
//4
if let results = request.results as? [VNFaceObservation] {
//5
for faceObservation in results {
@parente
parente / test_query_and_plot.ipynb
Created May 11, 2016 02:24
Various examples of ipywidgets and declarative widgets
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sniedes722
Sniedes722 / app.py
Created November 12, 2017 23:30
Upload A File to an S3 Bucket with Flask
import os
import boto3
from flask import Flask, render_template, request, url_for, redirect
app = Flask(__name__)
AWS_ACCESS_KEY_ID = os.environ['AWS_ACCESS_KEY_ID']
AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_ACCESS_KEY']
S3_BUCKET = os.environ['S3_BUCKET']
@tracend
tracend / aws_ec2_root.md
Created November 5, 2012 12:02
AWS EC2: Steps to enable root access with your local key - Inspired by: https://forums.aws.amazon.com/thread.jspa?threadID=86876

Note: replace {{server}} with your domain or ip

  • Login as the ec2-user
ssh -i key.pem ec2-user@{{server}}
  • Switch to administrator
sudo -i
def math(hours, wage, tax):
pretax = hours * wage #figures gross income
taxes = pretax * tax #figures how much goes into taxes
leftover = pretax - taxes #figures how much will be leftover
print "You have made $",pretax
print "Put $", taxes, " in the bank for taxes."
print "$", leftover, " is yours!!"
print "Figure out how much to put in the bank for taxes."
print "These figures are based on working in Colorado"
@selenamarie
selenamarie / prod_postgres.md
Last active March 15, 2019 05:12
An Ideal Postgres Environment

Ideal Postgres environment

Documentation

  • Documented replication topology
  • Documented network topology
  • Documented interface topology - including users, passwords, connection estimates, load balancers, connection proxies
  • Documented procedure, schedule for failover and testing
  • Documented procedure, schedule for disaster recovery and testing
@rishimukherjee
rishimukherjee / facepass.py
Created March 27, 2012 21:13
Example of use of SimpleCV. This creates a face recognized password.
#!/usr/bin/python
import time
from SimpleCV import Color, Image, np, Camera
cam = Camera() #initialize the camera
quality = 400
minMatch = 0.3
try:
password = Image("password.jpg")