Skip to content

Instantly share code, notes, and snippets.

View Endogen's full-sized avatar
🐍

Endogen Endogen

🐍
View GitHub Profile
@Endogen
Endogen / git_and_github_instructions.md
Created April 25, 2022 21:06 — forked from mindplace/git_and_github_instructions.md
Pushing your first project to github

1. Make sure git is tracking your project locally

Do you need a refresher on git? Go through Codecademy's git course.

  1. Using your terminal/command line, get inside the folder where your project files are kept: cd /path/to/my/codebase. → You cannot do this simply by opening the folder normally, you must do this with the command line/terminal.
    → Do you need a refresher on using your command line/terminal? I've compiled my favorite resources here.

  2. Check if git is already initialized: git status

Keybase proof

I hereby claim:

  • I am endogen on github.
  • I am endogen (https://keybase.io/endogen) on keybase.
  • I have a public key ASBb-xZ65MdbKJYWvxAb0xGwHoPRKVNp8OpVhK85Akcn-wo

To claim this, I am signing this object:

@Endogen
Endogen / pretty_print_update.py
Last active February 23, 2019 12:01
Pretty-Print Python-Telegram-Bot `update` Object
from pprint import pprint
pprint(update.to_dict())
@Endogen
Endogen / pyqt5_gui.py
Created September 27, 2017 14:27
Python3 GUI with PyQt5
#!/usr/bin/python3
import sys
import platform
from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication, QMessageBox, QDesktopWidget)
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import QFont
# TODO: Check with 'check_system' on which system we are and if on windows, do this:
@Endogen
Endogen / read-hackernews.py
Created August 24, 2017 21:53
Scrap Hackernews storys and read them
import requests
import subprocess
import time
# Install with "pip3.6 install beautifulsoup4"
from bs4 import BeautifulSoup
response = requests.get("https://news.ycombinator.com")
if response.status_code != 200:
@Endogen
Endogen / download-file-telegram-bot.py
Last active February 20, 2022 09:17
Download a file in Python-Telegram-Bot library
file_id = message.voice.file_id
newFile = bot.get_file(file_id)
newFile.download('voice.ogg')
@Endogen
Endogen / timing.py
Last active October 15, 2017 15:08
Get the execution time of a python script
#python3
# Source: https://stackoverflow.com/questions/1557571/how-do-i-get-time-of-a-python-programs-execution/12344609#12344609
import atexit
from time import time
from datetime import timedelta
def secondsToStr(t):
return str(timedelta(seconds=t))
@Endogen
Endogen / choose-kraken-key-via-mac.py
Last active August 18, 2017 20:42
Choose which Kraken API keys to use depending on current MAC address
from uuid import getnode as mac
# Read Kraken keys
with open("kraken.json") as kraken_keys_file:
kraken_keys = json.load(kraken_keys_file)
# Identify and choose Kraken API keys based on MAC address
# and return the Kraken object to call the API
def get_kraken_api():
if str(mac()) in kraken_keys:
@Endogen
Endogen / kraken-exception-handling.py
Last active August 10, 2017 23:02
Exception handling for Kraken API calls
# Will this solve the timeout errors properly?
# Errors lead to freeze(?)
try:
res_data = kraken.query_private("Balance")
except Exception as ex:
error(bot, update, ex)
cancel(bot, update)
@Endogen
Endogen / dynamic-buttons.py
Last active August 10, 2017 23:01
Get all tradable asset pairs, extract the coin name and create a button for each of them
# Send request to Kraken to get all tradable asset pairs
res_data = kraken.query_public("AssetPairs")
# If Kraken replied with an error, show it
if res_data["error"]:
update.message.reply_text(beautify(res_data["error"][0]))
return
currencies = list()