Skip to content

Instantly share code, notes, and snippets.

View WyattJia's full-sized avatar
🎯
Focusing

bitstring WyattJia

🎯
Focusing
View GitHub Profile
@tevino
tevino / epoll.go
Last active December 23, 2024 12:34
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@rasschaert
rasschaert / pycharm-community-3.0.2.tar.gz-to-rpm.bash
Last active February 6, 2024 12:27
Creates an RPM package for PyCharm Community Edition
#!/bin/bash
echo "Creating directory structure"
mkdir -p ./tmproot/usr/local/bin
mkdir -p ./tmproot/usr/share/applications
mkdir -p ./tmproot/usr/share/icons/hicolor/128x128/apps
mkdir -p ./tmproot/usr/share/icons/gnome/128x128/apps
mkdir -p ./tmproot/opt/
cd ./tmproot/opt
echo "Downloading tarball"
@reorx
reorx / hash_ring.py
Last active August 18, 2022 14:59
Consistent hash implementation in Python.
# -*- coding: utf-8 -*-
"""
hash_ring
~~~~~~~~~~~~~~
Implements consistent hashing that can be used when
the number of server nodes can increase or decrease (like in memcached).
Consistent hashing is a scheme that provides a hash table functionality
in a way that the adding or removing of one slot
does not significantly change the mapping of keys to slots.
# bash <(curl -s https://gist.github.com/drye/5387341/raw/ec72cddfe43ec3d39c91a3c118cb68ab14a049f8/enable_dnsmasq_on_osx.sh)
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for vbox domain
# ----------------------