Skip to content

Instantly share code, notes, and snippets.

View tobiasgoecke's full-sized avatar
🖖
working on next level of smart X environment

Tobias Goecke (Göcke) tobiasgoecke

🖖
working on next level of smart X environment
View GitHub Profile
# Taken from https://forums.aws.amazon.com/thread.jspa?messageID=332091
sudo su -
cd /usr/local/bin
mkdir ffmpeg
cd ffmpeg
wget http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.latest.tar.gz
tar -xzf ffmpeg.static.64bit.latest.tar.gz
# views.py
class EventFeed(ICalFeed):
"""
A simple event calender
"""
product_id = '-//example.com//Example//EN'
timezone = 'UTC'
file_name = "event.ics"
@beugley
beugley / s3_get.py
Last active December 4, 2021 14:58
Python boto3 script to download an object from AWS S3 and decrypt on the client side using KMS envelope encryption
#!/usr/bin/env python
###############################################################################
# This script downloads an object from AWS S3. If the object was encrypted,
# it will be decrypted on the client side using KMS envelope encryption.
#
# Envelope encryption fetches a data key from KMS and uses it to encrypt the
# file. The encrypted file is uploaded to an S3 bucket along with an encrypted
# version of the data key (it's encrypted with a KMS master key). You must
# have access to the KMS master key to decrypt the data key and file. To
# decrypt, the file is downloaded to the client, the encrypted data key is
@w3core
w3core / brightnessByColor.js
Created December 8, 2016 08:52
Calculate brightness value by RGB or HEX color
/**
* Calculate brightness value by RGB or HEX color.
* @param color (String) The color value in RGB or HEX (for example: #000000 || #000 || rgb(0,0,0) || rgba(0,0,0,0))
* @returns (Number) The brightness value (dark) 0 ... 255 (light)
*/
function brightnessByColor (color) {
var color = "" + color, isHEX = color.indexOf("#") == 0, isRGB = color.indexOf("rgb") == 0;
if (isHEX) {
var m = color.substr(1).match(color.length == 7 ? /(\S{2})/g : /(\S{1})/g);
if (m) var r = parseInt(m[0], 16), g = parseInt(m[1], 16), b = parseInt(m[2], 16);
@steveharoz
steveharoz / .block
Last active April 22, 2025 13:45 — forked from mbostock/.block
d3-force testing ground
license: gpl-3.0
height: 1030
scrolling: yes
@stevepiercy
stevepiercy / pyvenvex.py
Last active November 7, 2017 21:45 — forked from vsajip/pyvenvex.py
A script which demonstrates how to extend Python 3.3's EnvBuilder, by installing setuptools and pip in created venvs. This functionality is not provided as an integral part of Python 3.3 because, while setuptools and pip are very popular, they are third-party packages.The script needs Python 3.3 or later; invoke it using"python pyvenvex.py -h"fo…
#
# Copyright (C) 2013 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
@mbostock
mbostock / .block
Last active January 16, 2024 04:14
Force Dragging I
license: gpl-3.0
height: 600
@feliciaceballos
feliciaceballos / gist:8971704f5b6a653c610dcb48178470fc
Created April 24, 2016 02:05
Create Aurora Borealis Effect with CSS Animation
.aurora-borealis {
background: linear-gradient(#05051f, #05051f, #97f7f3, #05051f, #05051f, #05051f, #76f6bd, #aaebc9, #05051f, #05051f, #69c1ff, #cb304f, #05051f, #05051f, #05051f, #05051f, #4a5b8f, #419f91, #05051f, #05051f, #3a4aa1, #db3b69, #05051f);
background-size: 1800% 1800%;
-webkit-animation: Aurora 180s ease;
-moz-animation: Aurora 180s ease;
animation: Aurora 180s ease;
animation-iteration-count: 1;
}
@-webkit-keyframes Aurora {
@AndrewJHart
AndrewJHart / jwt_authentication.py
Created April 13, 2016 18:47
JWT authentication middleware for django rest framework that populates the request.user object
from django.utils.functional import SimpleLazyObject
from django.contrib.auth.models import AnonymousUser
from rest_framework.request import Request
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
def get_user_jwt(request):
"""
Replacement for django session auth get_user & auth.get_user for
@mekza
mekza / betterthanboto.py
Last active January 16, 2025 21:41
Signed URLs and Signed Cookies for CloudFront in Python with boto
from boto.cloudfront.distribution import Distribution
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
import base64
class BetterThanBoto(Distribution):
def sign_rsa(self, message):