Skip to content

Instantly share code, notes, and snippets.

View astrochun's full-sized avatar
😃
Hello, GitHub!

Chun Ly astrochun

😃
Hello, GitHub!
View GitHub Profile
@mwouts
mwouts / _introducing_itables.md
Last active February 12, 2024 13:14
Pandas DataFrames as interactive HTML DataTables

Pandas DataFrames as interactive HTML DataTables

In Jupyter Notebook, Jupyter Lab, Google Colab, VS Code and PyCharm

Pandas DataFrames are central to Data Analysis in Python. In this post, we introduce the itables Python package that enhances how these DataFrames are displayed, by turning them into interactive HTML DataTables.


Using itables is as simple as

@neelabalan
neelabalan / df_to_table.py
Created October 3, 2021 16:57 — forked from avi-perl/df_to_table.py
Convert a pandas.DataFrame object into a rich.Table object for stylized printing in Python.
from datetime import datetime
from typing import Optional
import pandas as pd
from rich import box
from rich.console import Console
from rich.table import Table
console = Console()
#!/bin/sh
echo ''
echo ' __________'
echo ' / ___ ___ \'
echo ' / / @ \/ @ \ \'
echo ' \ \___/\___/ /\'
echo ' \____\/____/||'
echo ' / /\\\\\//'
echo ' | |\\\\\\'
@br3ndonland
br3ndonland / github-actions-notes.md
Last active July 30, 2024 17:22
Getting the Gist of GitHub Actions
[tool.poetry.dependencies]
python = "3.7.7"
gdal = {platform = "windows", path = "thirdparty/GDAL-3.1.2-cp37-cp37m-win32.whl"}
fiona = {platform = "windows", path = "thirdparty/Fiona-1.8.13-cp37-cp37m-win32.whl"}
[tool.coverage.paths]
source = ["src", "*/site-packages"]
[tool.coverage.run]
branch = true
@tenuki
tenuki / multi_uvicorn.py
Last active February 24, 2024 01:18
How to run multiple uvicorn server apps in the same process (thanks @a-d-j-i )
##
## How to run multiple uvicorn server apps in the same process
##
import asyncio
from uvicorn import Server, Config
class MyServer(Server):
async def run(self, sockets=None):
self.config.setup_event_loop()
return await self.serve(sockets=sockets)
@aviadlevy
aviadlevy / .gitlab-ci.yml
Created April 11, 2019 06:54
.gitlab-ci.yml with versioning and changelog
image: docker:latest
services:
- docker:dind
stages:
- build
- integration
- dev-release
- prod-release
@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = martin.larralde@embl.de
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@Olliebrown
Olliebrown / configMacPortsMongo.md
Last active March 24, 2024 21:44
Configuring MongoDB installed from MacPorts

This is based on https://github.com/codeforamerica/ohana-api/wiki/Installing-MongoDB-with-MacPorts-on-OS-X

the macports version of MongoDB does not come pre-configured and will not run after installing until you change some settings. The instructions linked above describe a way to fix this but they ignore the fact that many of the directories are already created and owned by the user "_mongo". It also runs the daemon as root rather than _mongo. Below is a modified approach that uses the _mongo user and avoids creating unnecessary directories.

Install and Configure MongoDB

  1. Install mongodb with sudo port install mongodb (you probably want to start with a sudo port selfupdate)
  2. Create configuration directory with sudo mkdir /opt/local/etc/mongodb/
  3. Create configuration file with sudo pico /opt/local/etc/mongodb/mongod.conf
@kingspp
kingspp / logging.py
Created April 22, 2017 07:14
Python Comprehensive Logging using YAML Configuration
import os
import yaml
import logging.config
import logging
import coloredlogs
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'):
"""
| **@author:** Prathyush SP
| Logging Setup