Skip to content

Instantly share code, notes, and snippets.

@Martin91
Martin91 / mvcc.py
Last active February 24, 2023 21:07 — forked from elliotchance/transaction_example.py
https://elliot.land/implementing-your-own-transactions-with-mvcc, fixed a few runtime errors in the original gist and simulate a case that updating a deleting record
next_xid = 1
active_xids = set()
records = []
class TransactionConflictError(RuntimeError):
pass
def new_transaction():
@Martin91
Martin91 / git-selective-merge.md
Last active August 29, 2015 14:25 — forked from katylava/git-selective-merge.md
git selective merge

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b temp
@Martin91
Martin91 / route.sh
Last active August 29, 2015 14:21 — forked from kevinzhow/route.sh
# routes rule for ocserv
route = 8.0.0.0/255.0.0.0
route = 58.0.0.0/255.0.0.0
route = 23.0.0.0/255.0.0.0
route = 117.0.0.0/255.0.0.0
route = 199.0.0.0/255.0.0.0
route = 190.0.0.0/255.0.0.0
route = 198.0.0.0/255.0.0.0
route = 173.0.0.0/255.0.0.0
route = 174.0.0.0/255.0.0.0
@Martin91
Martin91 / ocserv
Last active August 29, 2015 14:21 — forked from kevinzhow/ocserv
#!/bin/sh
### BEGIN INIT INFO
# Provides: ocserv
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# Copyright Rene Mayrhofer, Gibraltar, 1999
# This script is distibuted under the GPL
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /rails_app_directory/public
# Redirect all requests that don't match a file on disk under DocumentRoot get proxied to Puma
RewriteEngine On
<Proxy balancer://unicornservers>
BalancerMember http://127.0.0.1:5100
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
@Martin91
Martin91 / Gemfile
Last active August 29, 2015 14:02 — forked from parndt/gist:1011435
How to cache refinery pages
# Rails4 full page caching is removed and extracted as gem, details from Rails Guides:
# Rails 4.0 has removed Action and Page caching from Action Pack.
# You will need to add the actionpack-action_caching gem in order to use caches_action
# and the actionpack-page_caching to use caches_pages in your controllers.
gem 'actionpack-page_caching'