Skip to content

Instantly share code, notes, and snippets.

View aic5's full-sized avatar

Alex Castro aic5

  • @thenewscoin
  • New York, NY
View GitHub Profile
@aic5
aic5 / cmd_progressbar.py
Last active January 13, 2018 20:39
Python: Command Line Progress Bar
# -*- coding: utf-8 -*-
'''
Python command line progress bar
v.: python 2.7
'''
# Print for python 2.7. Remove for python 3.5
from __future__ import print_function
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = chr(219)):
@aic5
aic5 / useful_pandas_snippets.py
Last active January 14, 2018 21:30 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]
@aic5
aic5 / distr_1.py
Created December 10, 2016 21:26
distr_1.py
# coding: utf-8
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import console
# example data
mu = 100 # mean of distribution
@aic5
aic5 / VBA_PasswordBreaker.vba
Last active March 11, 2022 20:08
[VBA] Excel Worksheet Password Breaker
'Breaks worksheet password protection.
Sub PasswordBreaker()
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
@aic5
aic5 / test_hash.py
Last active December 13, 2016 08:05
[Python] A script for simple hashing in SHA256
# coding: utf-8
import hashlib
import console
def input_string(prompt):
value = None
while value is None:
try:
value = raw_input(prompt)