Skip to content

Instantly share code, notes, and snippets.

@xgenvn
xgenvn / blackd.service
Last active November 18, 2023 18:40
BlackD Formatter as service
# /etc/systemd/system/blackd.service
# sudo systemctl start blackd
# sudo systemctl enable blackd
# sudo systemctl status blackd
[Unit]
Description=Black Formatter Service
[Service]
ExecStart=/home/brian/bin/miniconda3/bin/blackd --bind-host=127.0.0.1
@ababushk
ababushk / get_commit.groovy
Created August 14, 2019 15:48
Get commit hash without checkout step in Jenkins Pipeline in GitHub Organization Folder
def commitHashForBuild(build) {
def scmAction = build?.actions.find { action -> action instanceof jenkins.scm.api.SCMRevisionAction }
if (scmAction?.revision instanceof org.jenkinsci.plugins.github_branch_source.PullRequestSCMRevision) {
return scmAction?.revision?.pullHash
} else if (scmAction?.revision instanceof jenkins.plugins.git.AbstractGitSCMSource$SCMRevisionImpl) {
return scmAction?.revision?.hash
} else {
error("Build doesn't contain revision information. Do you run this from GitHub organization folder?")
}
}
@ivankreso
ivankreso / pillow-simd+libjpeg-turbo.txt
Last active May 29, 2019 14:57 — forked from soumith/gist:01da3874bf014d8a8c53406c2b95d56b
Install PillowSIMD+libjpeg-turbo on Conda
$ conda uninstall --force jpeg libtiff -y
$ conda install -c conda-forge libjpeg-turbo
$ CC="cc -mavx2" pip install --no-cache-dir -U --force-reinstall pillow-simd
@sasjo
sasjo / drain_jenkins.groovy
Last active April 8, 2024 22:09
Drain Jenkins build queue and stop all running jobs
Jenkins.instance.queue.items.findAll { !it.task.name.contains("Extenda") }.each {
println "Cancel ${it.task.name}"
Jenkins.instance.queue.cancel(it.task)
}
Jenkins.instance.items.each {
stopJobs(it)
}
def stopJobs(job) {
if (job in jenkins.branch.OrganizationFolder) {
// Git behaves well so no need to traverse it.
from sklearn.manifold import TSNE
from sklearn.preprocessing import MinMaxScaler
def get_scaled_tsne_embeddings(features, perplexity, iteration):
embedding = TSNE(n_components=2,
perplexity=perplexity,
n_iter=iteration).fit_transform(features)
scaler = MinMaxScaler()
scaler.fit(embedding)
@fedden
fedden / umap.py
Created November 20, 2017 12:03
import umap
from sklearn.preprocessing import MinMaxScaler
def get_scaled_umap_embeddings(features, neighbour, distance):
embedding = umap.UMAP(n_neighbors=neighbour,
min_dist=distance,
metric='correlation').fit_transform(features)
scaler = MinMaxScaler()
@timbophillips
timbophillips / couchdb-ubuntu-zesty.txt
Created August 13, 2017 09:11
couchdb 2.1 installation packages ubuntu zesty 17.04
# install from this website
http://docs.couchdb.org/en/latest/install/unix.html#installation-using-the-apache-couchdb-convenience-binary-packages
# add this to apt sources so that libicu55 is available (libicu57 has replaced it in zesty)
deb http://security.ubuntu.com/ubuntu xenial-security main
@asford
asford / .gitignore
Last active April 5, 2023 11:58
pybind11 ostream example
# Created by https://www.gitignore.io/api/c++,cmake
### C++ ###
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
#!/bin/bash
BIN=/usr/bin
MAN=/usr/share/man/man1
PRIORITY=360
BINV=3.6
MANV=3.6.1
update-alternatives --install $BIN/clang clang $BIN/clang-$BINV $PRIORITY \
@ankurk91
ankurk91 / bash_profile.md
Last active October 22, 2023 12:16
:octocat: Git branch name in Linux/Mac Bash Terminal

Mac OS : Show your git branch name on your bash terminal

⚠️ Does not work in zsh terminal

Add these lines in your ~/.bash_profile file

# Show current git branch name
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}