Skip to content

Instantly share code, notes, and snippets.

View iphysresearch's full-sized avatar
🏛️
researching .....

He Wang iphysresearch

🏛️
researching .....
View GitHub Profile
@kazewong
kazewong / spline.py
Last active December 2, 2023 16:55
Cubic Spline with lineax
import lineax as lx
import jax.numpy as jnp
import jax
from jaxtyping import Float, Array
class CubicSpline:
x_grid: Float[Array, str("batch")] # input x data
y_grid: Float[Array, str("n")] # input y data
@RobertKrajewski
RobertKrajewski / mattermost-dl.py
Last active May 12, 2024 18:33
This script allows to export the content (text+files) of an interactively selected Mattermost channel (public, private, group, direct message) to files. Tested on Mattermost 5.27 using Python 3.7
import os
import sqlite3
from datetime import datetime, date
from typing import Tuple, Dict, List
import getpass
from mattermostdriver import Driver
import pathlib
import json
@mob-sakai
mob-sakai / _README.md
Last active May 8, 2024 08:10
Run shell script on gist

Run shell script on gist

Shells that support process substitution such as bash and zsh allow to run shell script on gist as follows.

# With curl:
bash <(curl -sL ${GIST_URL}) args...

# With wget:
@iphysresearch
iphysresearch / cumulative_numbe_of_GWevents.py
Last active November 5, 2020 09:42
Python script to plot cumulative number of events vs days in O1, O2, O3 (not including breaks). See more: https://iphysresearch.github.io/blog/post/gw/cumulative_numbe_of_gwevents/
import numpy as np
import datetime
import matplotlib.pyplot as plt
gw_event = [20150914,20151012,20151226, # O1 events
20170104,20170608,20170729,20170809,20170814,20170817,20170818,20170823,
20190408,20190412,20190413,20190413,20190421,20190424,20190425,20190426,
20190503,20190512,20190513,20190514,20190517,20190519,20190521,20190521,
20190527,20190602,20190620,20190630,20190701,20190706,20190707,20190708,
20190719,20190720,20190727,20190728,20190731,20190803,20190814,20190828,
@GitMurf
GitMurf / attr-table-filters.js
Last active June 13, 2023 03:16
Filtering attribute tables
/*
****************************************************************************************
****************************************************************************************
****************************************************************************************
NOW HOSTING CODE VIA MY MAIN GITHUB REPOSITORY FOR ROAM SO THAT USERS CAN LINK DIRECTLY TO THE CODE AND AUTO UPDATE
GO HERE FOR INSTALLATION INSTRUCTIONS: https://github.com/GitMurf/roam-javascript#installation
****************************************************************************************
@iphysresearch
iphysresearch / MFCNN.py
Last active September 14, 2021 01:40
Chapter 6 - MFCNN
import mxnet as mx
from mxnet import nd, gluon
from mxnet.gluon.nn import Dense, ELU, LeakyReLU, LayerNorm, Conv2D, MaxPool2D, Flatten, Activation, Dropout
import os, sys, datetime
from loguru import logger
#### REF #### https://loguru.readthedocs.io/en/stable/api/logger.html
# DEBUG 10 # INFO 20 # WARNING 30 # ERROR 40 # CRITICAL 50
config = {
"handlers": [
@velikodniy
velikodniy / torch_delete.ipynb
Created January 21, 2020 10:29
np.delete ported to PyTorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@typebrook
typebrook / README.md
Last active May 10, 2024 18:57
A bash script for gist management #bash #gist
@iphysresearch
iphysresearch / redis_demo.py
Last active January 10, 2019 08:18
[Redis-py 3.0 demo] a demo for Redis-py 3.0 (http://gree2.github.io/python/2016/05/14/python-with-docker-redis) #redis #demo #python
#! usr/bin/python
#coding=utf-8
# http://gree2.github.io/python/2016/05/14/python-with-docker-redis
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys, os, time
@ericmjl
ericmjl / ds-project-organization.md
Last active May 17, 2024 20:27
How to organize your Python data science project

UPDATE: I have baked the ideas in this file inside a Python CLI tool called pyds-cli. Please find it here: https://github.com/ericmjl/pyds-cli

How to organize your Python data science project

Having done a number of data projects over the years, and having seen a number of them up on GitHub, I've come to see that there's a wide range in terms of how "readable" a project is. I'd like to share some practices that I have come to adopt in my projects, which I hope will bring some organization to your projects.

Disclaimer: I'm hoping nobody takes this to be "the definitive guide" to organizing a data project; rather, I hope you, the reader, find useful tips that you can adapt to your own projects.

Disclaimer 2: What I’m writing below is primarily geared towards Python language users. Some ideas may be transferable to other languages; others may not be so. Please feel free to remix whatever you see here!