Skip to content

Instantly share code, notes, and snippets.

View zbjdonald's full-sized avatar

Baiju Zhang zbjdonald

View GitHub Profile
@tsvikas
tsvikas / joblib_parallel_with_tqdm.py
Last active May 17, 2024 12:11
joblib.Parallel, but with a tqdm progressbar
import tqdm
from joblib import Parallel
class ParallelTqdm(Parallel):
"""joblib.Parallel, but with a tqdm progressbar
Additional parameters:
----------------------
total_tasks: int, default: None
@mgbckr
mgbckr / _read_csv_joblib.md
Last active May 24, 2024 00:45
Reading a large CSV file via pandas and joblib. Probably degrades due to pd.concat usage. Tests and better function parameter definitions and documentation pending.

Parallelized pd.read_csv with joblib

Reading a large CSV file via pandas and joblib. Probably degrades due to pd.concat usage. Tests and better function parameter definitions and documentation pending.

A very objective test on a 5GB CSV file (shape=()) resulted in a Kernel died message (it was run in a Jupyter notebook and repeated twice) when using pd.read_csv directly. In contrast, using read_csv_joblib with the following settings returned in 3h 4m: Concatenating the row chunks took the longest.

@zhangzhibin
zhangzhibin / install-tr-control-gitee-fixed.sh
Last active February 18, 2023 16:34
fixed install-tr-control script to overcome the installation error: cp: cannot stat '/tmp/tr-web-control/transmission-web-control-version/src/.': No such file or directory, refer to https://xmanyou.com/transmission-web-control-error-404-not-found/
#!/bin/bash
# 获取第一个参数
ARG1="$1"
ROOT_FOLDER=""
SCRIPT_NAME="$0"
SCRIPT_VERSION="1.2.3"
VERSION=""
WEB_FOLDER=""
ORG_INDEX_FILE="index.original.html"
INDEX_FILE="index.html"
@mikestecker
mikestecker / optimising-unifi-performance.md
Last active April 22, 2024 13:32
optimising-unifi-performance

optimising-unifi-performance

NOTE: Content below is written by Adrian Mace. Click here for an updated version.

Below are the key settings that I apply on any unifi installation for optimal performance.

Settings

Settings > Site

  • Ensure Enable Advanced Features is enabled
    This allows you to follow along with the guide in it's entirety.
@chad-m
chad-m / streamlit_download_button.py
Last active April 1, 2024 02:28
A download function and examples app for Streamlit
import base64
import os
import json
import pickle
import uuid
import re
import streamlit as st
import pandas as pd
@okld
okld / multipage_settings_app.py
Last active May 21, 2024 15:33
Streamlit - Settings page with session state
import streamlit as st
from persist import persist, load_widget_state
def main():
if "page" not in st.session_state:
# Initialize session state.
st.session_state.update({
# Default page.
"page": "home",
@hungtcs
hungtcs / tooltip-formatter.ts
Created July 22, 2019 10:00
echarts tooltip formatter function with unit supported
import { EChartOption } from 'echarts';
declare interface _Format extends EChartOption.Tooltip.Format {
marker: string;
axisValueLabel: string;
}
const formatter: EChartOption.Tooltip.Formatter = function(params: _Format|Array<_Format>, _ticket, _callback) {
if(params instanceof Array) {
if(params.length) {
@ciiiii
ciiiii / Dockerfile
Last active January 21, 2024 12:30
Postgresql for Chinese Full-Text Search.中文全文搜索
# If you don‘t want to build it youself, you can try `docker pull killercai/postgres`.
FROM healthcheck/postgres:latest
# China debian mirror
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean && apt-get update
RUN apt-get install -y wget git build-essential libpq-dev python-dev postgresql-server-dev-all
# SCWS (Simple Chinese Word Segmentation library)
RUN cd /tmp && wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.1.tar.bz2 | tar xjf - && cd scws-1.2.1 && ./configure && make install
# zhpaser (postgres plugin)
@jerodg
jerodg / windows_and_office_kms_setup.adoc
Last active May 24, 2024 18:48
Activate Windows and Office Using KMS Server

Microsoft Windows and Office KMS Setup

@alimanfoo
alimanfoo / find_runs.py
Created November 5, 2017 23:53
Find runs of consecutive items in a numpy array.
import numpy as np
def find_runs(x):
"""Find runs of consecutive items in an array."""
# ensure array
x = np.asanyarray(x)
if x.ndim != 1:
raise ValueError('only 1D array supported')