Skip to content

Instantly share code, notes, and snippets.

@cosu
cosu / translate.py
Created December 4, 2016 10:01
microsoft translator api
import requests
def auth(subscription_key):
url = 'https://api.cognitive.microsoft.com/sts/v1.0/issueToken?Subscription-Key=' + subscription_key
response = requests.post(url)
return response.text
def translate(text, token, from_language, to_language):
@cosu
cosu / brew-update.sh
Created April 7, 2014 21:05
creates a notification for outdated homebrew packages
#!/bin/bash
#
# Notify of Homebrew updates via Notification Center on Mac OS X
#
# Author: Chris Streeter http://www.chrisstreeter.com
# Requires: terminal-notifier. Install with:
# gem install terminal-notifier or brew install terminal-notifier
TERM_APP='/Applications/Terminal.app'
BREW_EXEC='/usr/local/bin/brew'
@cosu
cosu / rsakey.py
Created November 12, 2012 10:57
Toy script to create a RSA key from scratch
__author__ = 'cdumitru'
from Crypto.PublicKey import RSA
from Crypto import Random
import gmpy
import base64
#tup (tuple) - A tuple of long integers, with at least 2 and no more than 6 items. The items come in the following order:
#RSA modulus (n).
@cosu
cosu / rc4brute.py
Created November 5, 2012 13:26
Educational tool to bruteforce RC4 encrypted files.
__author__ = 'cdumitru'
import sys
from Crypto.Cipher import ARC4
import numpy
import string
import itertools
from multiprocessing import Pool
from time import time
import cProfile