Skip to content

Instantly share code, notes, and snippets.

@jjmark15
jjmark15 / num_input.py
Last active February 10, 2018 13:23
input function for numerical values
def num_input(prompt='Enter value: '):
again = True
while again:
inp = input(prompt)
if len(inp) == 0:
return 0
else:
try:
inp = float(inp)
if inp.is_integer():

Keybase proof

I hereby claim:

  • I am jjmark15 on github.
  • I am ohblondone (https://keybase.io/ohblondone) on keybase.
  • I have a public key ASBUVFCTX7jaQp_Dv-PMN010plPZdchSF4WBp9wtoGwyxwo

To claim this, I am signing this object:

@jjmark15
jjmark15 / progress.py
Last active November 6, 2017 19:12 — forked from vladignatyev/progress.py
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the Software
# is furnished to do so, subject to the following conditions:
#
@jjmark15
jjmark15 / ftp example.py
Created February 10, 2018 13:14
example of using ftp in python with ftplib
from ftplib import FTP
ftp = FTP('domainname.com')
ftp.login(user='username', passwd='password')
ftp.cwd('/specificdomain-or-location/')
def grabFile():
filename = 'filename.txt'
localfile = open(filename, 'wb')
@jjmark15
jjmark15 / argparse_example.py
Last active February 10, 2018 13:57
example using argparse for command line cli utils
import argparse
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--x', type=float, default=1.0,
help='What is the first number?')
parser.add_argument('--y', type=float, default=1.0,
help='What is the second number?')
parser.add_argument('--operation', type=str, default='add',
@jjmark15
jjmark15 / decorator_example.py
Created February 10, 2018 14:44
example of using a decorator in python
def our_decorator(func):
def function_wrapper(x):
print("Before calling " + func.__name__)
res = func(x)
print(res)
print("After calling " + func.__name__)
return function_wrapper
@jjmark15
jjmark15 / README.md
Last active January 25, 2019 18:50
Description of my preferred git naming conventions

Branch names

<BRANCH TYPE>/<ISSUE REFERENCE>-<SHORT BRANCH DESCRIPTION>_<GIT USERNAME>

e.g. feature/#2-update-readme_jjmark15

@jjmark15
jjmark15 / README.md
Last active January 25, 2019 21:24
Remove duplicates from an array

If you want to test different ways of creating a unique array in terms of speed check out here

@jjmark15
jjmark15 / mac-setup.md
Last active July 4, 2019 21:41
Mac Setup Steps

Mac Setup

  1. Homebrew/terminal/bash

    1. homebrew

      • xcode-select --install
        /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew update

@jjmark15
jjmark15 / strict_mode_bash.sh
Last active January 28, 2020 20:12
Bash Strict Mode
#!/bin/env bash
set -euo pipefail
IFS=$'\n\t'