Skip to content

Instantly share code, notes, and snippets.

View svmihar's full-sized avatar
🙏

sumihar christian svmihar

🙏
View GitHub Profile
@svmihar
svmihar / hkt_in_python.py
Created October 29, 2020 02:53 — forked from sobolevn/hkt_in_python.py
Higher Kinded Types in Python
import abc
import dataclasses
from typing import Callable, Generic, TypeVar
# TODO: pip install returns
# TODO: add `returns.contrib.mypy.returns_plugin` to mypy plugins
# TODO: read the docs at https://github.com/dry-python/returns
from returns.primitives.hkt import Kind1, SupportsKind1, kinded
_ValueType = TypeVar('_ValueType')
@svmihar
svmihar / Sphinx_Setup_for_autodoc.md
Created October 20, 2020 04:16 — forked from GLMeece/Sphinx_Setup_for_autodoc.md
Setting up Sphinx for generating documentation from DocStrings, leveraging the Napoleon extension.

Sphinx Setup for autodoc

Sphinx is a documentation generator that is the de facto standard for Python projects. The official documentation can be a bit daunting as it includes so many options, it's hard to know where to start.

Note: This Gist was updated on 04/04/2019 to accomodate a newer version of Sphinx, as well as Python 3.7. YMMV!

This document is written with the following presuppositions:

@svmihar
svmihar / client.py
Created April 21, 2020 09:29 — forked from kylehounslow/client.py
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@svmihar
svmihar / install-conda.sh
Created September 9, 2019 17:55 — forked from lneeraj97/install-conda.sh
Install Miniconda in Ubuntu
# Setup Ubuntu
sudo apt update --yes
sudo apt upgrade --yes
# Get Miniconda and make it the main Python interpreter
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p ~/miniconda
rm ~/miniconda.sh
export PATH=~/miniconda/bin:$PATH
@svmihar
svmihar / GitCommitEmoji.md
Created August 11, 2019 21:42 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@svmihar
svmihar / Google Colab SSH
Created July 10, 2019 02:44 — forked from yashkumaratri/Google Colab SSH
SSH into google colab
#CODE
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
@svmihar
svmihar / git-change-commit-messages.md
Created June 8, 2019 02:55 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

import cv2
from time import sleep, time
import sys
import curses
from curses import wrapper
x = 160
sx = 4
@svmihar
svmihar / graphql_example.py
Created February 10, 2019 01:16 — forked from gbaman/graphql_example.py
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200: