Skip to content

Instantly share code, notes, and snippets.

@tanimislam
tanimislam / probdistro.py
Created October 23, 2015 21:10
Python module that contains functionality to calculate a FUNKY collection of distribution functions, that sum to 1 over M sample points.
#!/usr/bin/env python
import numpy, pandas, pylab
def _return_prob_dist_sub(M = 5, N = 1000000):
us = numpy.random.random_sample((M-1, N))
ainits = numpy.zeros((M, N))
#
z = numpy.ones( N )
ainits[0,:] = z * us[0,:]
@tanimislam
tanimislam / demo.html
Last active December 5, 2015 00:16
demo LaTeX code to test Ryver
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
</head>
@tanimislam
tanimislam / tracpac.py
Last active March 17, 2016 23:19
This will give you the latest information on your USPS package. Just give it the USPS tracking number of your package, and it will give you a status or summary if valid. Requires PyQt4 and requests to run.
#!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import requests, os, sys
from xml.etree import ElementTree
"""
This will give you the latest information on your USPS package. Just
give it the USPS tracking number of your package, and it will give you
#!/usr/bin/env python
from icalendar import Calendar, Event
from bs4 import BeautifulSoup
import pytz, datetime, os, sys
from requests.compat import urljoin
from optparse import OptionParser
def get_events_from_html( htmlfile ):
html = BeautifulSoup( open( htmlfile, 'r' ), 'lxml' )
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tanimislam
tanimislam / .gitignore
Last active January 16, 2020 06:57
download_slashdot_by_year
# old URL: https://gist.github.com/tanimislam/305f551f09ceaffff2b8e142dd8c5e31
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# MS word and latex extensions
*.bak
*.aux
*.log
@tanimislam
tanimislam / .gitignore
Last active February 27, 2020 20:33
This converts an MP4 movie, with SRT file, and name and year into an MKV file with English subtitles
# don't upload the database
# app.db
*.core
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# MS word and latex extensions
*.bak
@tanimislam
tanimislam / .gitignore
Last active March 12, 2020 20:07
description of something that creates nonsensical images when using Python's multiprocessing framework
*.png
@tanimislam
tanimislam / demonstration_musicbrainz_picard.py
Created March 21, 2020 17:19
This is a demonstration using Picard's API to search for artists, albums, tracks
#!/usr/bin/env python3
@tanimislam
tanimislam / demo_create_movie_sequence.py
Created July 6, 2020 05:25
Sequence of images into an MP4 file
#!/usr/bin/env python3
"""
I developed this Python CLI script to demonstrate creating an MP4 movie from an image sequence.
I follow instructions from https://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video. I make an MP4 movie that is 5 FPS with psychovisual quality of 25.
"""
import os, sys, numpy, subprocess, glob, re, logging, time
from PIL import Image
from distutils.spawn import find_executable
from argparse import ArgumentParser