View dynamic-dag-creation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from airflow.operators.http_operator import SimpleHttpOperator | |
from airflow.operators.postgres_operator import PostgresOperator | |
from airflow.operators.dummy_operator import DummyOperator | |
from airflow.hooks.postgres_hook import PostgresHook | |
from airflow.models import Variable, DAG | |
from datetime import date, datetime, timedelta |
View task-dag-creation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from airflow.operators.http_operator import SimpleHttpOperator | |
from airflow.operators.postgres_operator import PostgresOperator | |
from airflow.operators.subdag_operator import SubDagOperator | |
from airflow.operators.sensors import SqlSensor | |
from airflow.hooks.postgres_hook import PostgresHook | |
from airflow.operators.python_operator import PythonOperator | |
from airflow.models import Variable, DAG |
View aes_encryption.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AesCrypt256: | |
#Based on https://gist.github.com/pfote/5099161 | |
BLOCK_SIZE = 16 | |
# To use the null/x00 byte array for the IV | |
default_initialization_vector = False | |
def __init__(self, default_initialization_vector=False): | |
self.default_initialization_vector = default_initialization_vector | |
View list_partitions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "given an array of integers and a number n, partition the array into | |
# n pieces so that their sums are as equal as possible" | |
import itertools | |
import numpy as np | |
import sys | |
def powerset(input:list) -> list: | |
# returns a list of tuple lists of all of the permutations of elements | |
# [1,2,3] -> [[(1, 2, 3)], [(1,), (2, 3)], [(1,), (2,), (3,)], [(1,), (3,), (2,)], |
View AESBytesEncryptor-2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte[] iv = this.ivGenerator.generateKey(); | |
byte[] encrypted = doFinal(this.encryptor, bytes); | |
return this.ivGenerator != NULL_IV_GENERATOR ? concatenate(iv, encrypted) : encrypted; |
View Type Hints | mypy.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View AES256 No IV Encryption
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
# PyCryptodome, NOT pycrypto | |
from Crypto.Cipher import AES | |
from Crypto.Protocol.KDF import PBKDF2 | |
class AesCrypt256: | |
#Based on https://gist.github.com/pfote/5099161 | |
BLOCK_SIZE = 16 | |
def pkcs5_pad(self,s): | |
""" |
View crontab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Nginx - logrotate & upload to S3 | |
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/nginx | |
15 0 * * * s3cmd put /var/log/nginx/access.log-`date +"\%Y\%m\%d"`.gz s3://$LOGS_BUCKET_NAME/nginx-access/`date +"dt=\%Y\%m\%d"`/`hostname -s`.access.log-`date +"\%Y\%m\%d"`.gz |
View Hoeffding Inequality.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View brush.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(!d3.chart) d3.chart = {}; | |
d3.chart.brush = function() { | |
var g; | |
var data; | |
var width = 600; | |
var height = 30; | |
var dispatch = d3.dispatch(chart, "filter"); | |
function chart(container) { |
NewerOlder