Skip to content

Instantly share code, notes, and snippets.

@matriphe
matriphe / redis.service
Last active September 22, 2020 11:01
Redis Systemd Service (Debian Based)
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
Type=forking
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf
ExecStop=/usr/local/bin/redis-cli shutdown
@ttimasdf
ttimasdf / Open iterm tab here
Last active March 1, 2020 17:49 — forked from eric-hu/Open iterm tab here
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder.To use:(1) Open Automator(2) Create a new service(3) Change "Service receives selected" drop downs to "Files or folders" in "Finder"(4) Select "Run applescript" from the sidebar, then paste this script in and save
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set is_folder to (do shell script "file -b " & quoted form of (POSIX path of my_file))
if is_folder ends with "directory" then

Kafka installation with systemd

0. Create kafka user

sudo adduser kafka
sudo adduser kafka sudo
su -l kafka

1. Download and Install kafka archive

@komuw
komuw / pycrypto_AES.py
Created February 15, 2016 14:19
python AES with CBC/PKCS5Padding
from Crypto.Cipher import AES
from Crypto import Random
import base64
block_size = AES.block_size
#unpad = lambda s : s[0:-ord(s[-1])]
def pad(plain_text):

最终实现效果:

  1. 无版本概念,任何本地文件均可增量升级到最新.服务器不用管理多版本
  2. 内存小,100M文件升级时只占用500KB内存.

使用流程:

  1. 制作新版本,上传HTTP File Server.
  2. Client自动计算差异,下载差异,合并差异.
  3. done!

#0.起源

@boardstretcher
boardstretcher / install_fpm.sh
Last active October 4, 2019 02:15
Install FPM on centos 6.5
# install ruby, rubygems and all requirements, then install FPM (effing package manager)
# fpm: https://github.com/jordansissel/fpm
# as root
# update system, install requirements
yum update -y
yum install ruby-devel gcc curl libyaml-devel
# get the ruby version manager and install
curl -L get.rvm.io | bash -s stable
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active June 24, 2024 19:36
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@rduplain
rduplain / app.py
Created January 30, 2012 15:49
Serve a Flask app on a sub-url during localhost development.
"Serve a Flask app on a sub-url during localhost development."
from flask import Flask
APPLICATION_ROOT = '/spam'
app = Flask(__name__)
app.config.from_object(__name__)