Skip to content

Instantly share code, notes, and snippets.

View diek's full-sized avatar

Derrick Kearney diek

  • Halifax, NS, Canada
View GitHub Profile
Title Author Genre Height Publisher
Fundamentals of Wavelets Goswami, Jaideva signal_processing 228 Wiley
Data Smart Foreman, John data_science 235 Wiley
God Created the Integers Hawking, Stephen mathematics 197 Penguin
Superfreakonomics Dubner, Stephen economics 179 HarperCollins
Orientalism Said, Edward history 197 Penguin
Nature of Statistical Learning Theory, The Vapnik, Vladimir data_science 230 Springer
Integration of the Indian States Menon, V P history 217 Orient Blackswan
Drunkard's Walk, The Mlodinow, Leonard science 197 Penguin
Image Processing & Mathematical Morphology Shih, Frank signal_processing 241 CRC
@rg3915
rg3915 / gen_random_datetime.py
Last active February 18, 2023 15:09
Generate Random Datetime Python
import random
from datetime import datetime, timedelta
min_year=1900
max_year=datetime.now().year
start = datetime(min_year, 1, 1, 00, 00, 00)
years = max_year - min_year+1
end = start + timedelta(days=365 * years)
@henriquebastos
henriquebastos / test_image_and_file_field.py
Last active March 24, 2020 19:30
This is a simple proof of concept demonstrating how I like to handle files during tests.
"""
This is a simple proof of concept demonstrating how I like to handle files during tests.
Setup
-----
wget http://hbn.link/1NoLHf0
virtualenv .venv
source .venv/bin/activate
pip install django django-inmemorystorage
@francoisromain
francoisromain / project-create.sh
Last active June 14, 2024 09:55
A bash script to create a Git post-receive hook to deploy after a Git push
#!/bin/bash
# source: https://gist.github.com/francoisromain/58cabf43c2977e48ef0804848dee46c3
# and another script to delete the directories created by this script
# project-delete.sh: https://gist.github.com/francoisromain/e28069c18ebe8f3244f8e4bf2af6b2cb
# Call this file with `bash ./project-create.sh project-name`
# - project-name is mandatory
# This will creates 4 directories and a git `post-receive` hook.
@fleepgeek
fleepgeek / apps.py
Last active September 10, 2024 20:50
A Django Middleware to prevent multiple sessions for the same user. It automatically logs out the previous session and replaces it with the new session.
from django.apps import AppConfig
class ForumConfig(AppConfig):
name = 'forum'
# This function is the only new thing in this file
# it just imports the signal file when the app is ready
def ready(self):
import your_app_name.signals
@bradtraversy
bradtraversy / django_deploy.md
Last active June 1, 2026 14:58
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@drem-darios
drem-darios / salt_signature_36.py
Created February 10, 2020 06:08
Python example of how to create a salt and use a secret key to generate a signature using the salt. This was tested with Python 3.6.8
import hmac
import os
import hashlib
import base64
import unittest
__author__ = 'drem'
class SecurityUtil(object):
@pydanny
pydanny / Makefile.bash
Created June 20, 2020 18:10
Fixing OSX Upload Speed
ls:
ls -l /Library/Preferences/SystemConfiguration/
backup:
sudo mv /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/projects/wifi-backup
sudo mv /Library/Preferences/SystemConfiguration/com.apple.network.eapolclient.configuration.plist ~/projects/wifi-backup
sudo mv /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist ~/projects/wifi-backup
sudo mv /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist ~/projects/wifi-backup
sudo mv /Library/Preferences/SystemConfiguration/preferences.plist ~/projects/wifi-backup
@ipmb
ipmb / sandbox.sb
Created March 18, 2022 16:06
Playing around with sandbox-exec for local development
(version 1)
(allow default)
(debug deny)
(define (home-subpath home-relative-subpath)
;; should be able to use something like (param "HOME_DIR") here, but it's not working for me
(subpath (string-append "/Users/pete" home-relative-subpath)))
;; can't write anywhere or read /Users by default
(deny file-write*)