Skip to content

Instantly share code, notes, and snippets.

@jimorsm
jimorsm / pyenv.sh
Last active November 15, 2018 21:57 — forked from bylatt/pyenv.sh
install python3.6.0 on centos 7
#!/bin/sh
# install pyenv on centos 7
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> .zshrc
echo 'eval "$(pyenv init -)"' >> .zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> .zshrc
@rivo
rivo / serve.go
Created November 26, 2017 12:28
Graceful stop and restart for HTTP servers in Go
package main
import (
"context"
"fmt"
"net"
"net/http"
"os"
"os/exec"
"os/signal"
@BetsuNo
BetsuNo / centrifugo
Last active May 10, 2022 15:29
nginx, php-fpm, memcached and centrifugo rc.d scripts for CentOS 7
#!/bin/bash
#
# /etc/init.d/centrifugo
#
# Startup script for centrifugo
#
# chkconfig: 2345 20 80
# description: Starts and stops centrifugo
# Source function library.
@koreyou
koreyou / bm25.py
Created November 1, 2019 05:26
Implementation of OKapi BM25 with sklearn's TfidfVectorizer
""" Implementation of OKapi BM25 with sklearn's TfidfVectorizer
Distributed as CC-0 (https://creativecommons.org/publicdomain/zero/1.0/)
"""
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from scipy import sparse
class BM25(object):
@pvsune
pvsune / concurrent.kafka.consumer.py
Last active April 22, 2025 14:17
A multiprocess multithreaded Kafka consumer
#!/usr/bin/env python
import logging
import os
import threading
import time
from multiprocessing import Process
from queue import Queue
from confluent_kafka import Consumer