Skip to content

Instantly share code, notes, and snippets.

View clamytoe's full-sized avatar
💭
Striving to learn something new each day.

Martin Uribe clamytoe

💭
Striving to learn something new each day.
View GitHub Profile
@clamytoe
clamytoe / print_stuff.py
Created April 25, 2018 06:48
print_stuff.py
"""
FB Challenge: https://www.facebook.com/groups/251560641854558/permalink/622857261391559/
"""
def printStuff(num):
start = ''.join(list(map(str, range(1, num + 1))))
for x in range(num, 0, -1):
print(f'{x}{start[1:num]}')
num -= 1
print()
@clamytoe
clamytoe / times_table.py
Last active March 15, 2018 11:25
Script to generate multiplication times tables.
def gen_table(nums, stop=12):
for num in nums:
print(gen_title(num))
for x in range(1, stop+1):
result = pad(num * x, 3)
print(f' {pad(num)} x {pad(x)} = {result}')
print('')
def gen_title(num):
@clamytoe
clamytoe / check_kernels.sh
Last active November 7, 2019 13:04
Small script to check what kernels are installed with a note on how to remove unwanted ones.
#!/bin/bash
clear
echo "##################"
echo "# CURRENT KERNEL #"
echo "##################"
echo ""
uname -r
echo ""
echo "######################"
echo "# INSTRALLED KERNELS #"
@clamytoe
clamytoe / get_vids.py
Created March 1, 2018 16:39
Linux only script for downloading all of the videos for edX course HardvardX: PH526x - Using Python for Research
#!/home/mohh/anaconda3/bin/python
from collections import namedtuple
from os import system
Video = namedtuple('Video', 'name link')
videos = [
Video('0.1 - Introduction', 'https://edx-video.net/HARUPRXX2016-V000100_DTH.mp4'),
Video('1.1.1 - Python Basics', 'https://edx-video.net/HARUPRXX2016-V000200_DTH.mp4'),
Video('1.1.2 - Objects', 'https://edx-video.net/HARUPRXX2016-V000400_DTH.mp4'),
@clamytoe
clamytoe / hangman.py
Created January 26, 2018 11:26
hangman.py
from os import system, name
from time import sleep
from console import clear
# art from https://codereview.stackexchange.com/questions/101968/hangman-with-ascii
ascii_art = ("""
_________
|/
|
@clamytoe
clamytoe / fizzbuzz.py
Last active December 9, 2017 01:15
FizzBuzz challenge built with TDD...
def check_value(value):
"""
Validates the value that was passed into the program.
:param value: A positive integer is the only valid value
:return: int or an exception is raised
"""
if isinstance(value, bool):
raise ValueError
elif isinstance(value, str):
@clamytoe
clamytoe / get_pid.sh
Created December 2, 2017 17:03
Scripts that I use to keep my Slack bot running if it gets disconnected.
#!/bin/bash
ps awxx | grep $1 | grep -v get_pid | grep -v grep | awk '{print $1}'
@clamytoe
clamytoe / secret.py
Created October 19, 2017 03:00
secret.py
# secret message code challenge
# https://dev.to/rpalo/secret-message-7do
from string import ascii_lowercase
from long_string import code
ALPHA = ascii_lowercase + '_'
def count(letters):
counts = {}
@clamytoe
clamytoe / ip_address.sh
Created September 13, 2017 12:42
Script to quickly check your active IP addresses.
#!/bin/bash
echo $(ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{print $1}')
@clamytoe
clamytoe / memModules.sh
Created September 13, 2017 12:27
One liner script to display the memory module(s) information of your system.
#!/bin/bash
sudo dmidecode | awk '/^Memory\ Device$/,/Size/{if ($0~/Size/)print}'