Skip to content

Instantly share code, notes, and snippets.

View ybur-yug's full-sized avatar

yburyug ybur-yug

View GitHub Profile
@aphyr
aphyr / gist:0ad3458a1478db97517e7ac2faf2da00
Created October 5, 2017 19:13
Advice on benchmarking databases
Hi S-------. I'm not an expert in performance benchmarking--I focus on
correctness and safety--but I have a few pieces of advice here.
0. Pick multiple workloads that cover the gamut of behaviors in each DB.
*Don't* choose a completely sharded workload for VoltDB. Don't choose a
purely commutative workload for Cassandra. Cassandra's Paxos
implementation is slow and a good benchmark will demonstrate
that--however, it *doesn't* (I think?) require a global coordinator,
which means it might *scale* better than a single-coordinator system
like, say, VoltDB. Talk about those differences!
#!/bin/sh
# Reboot netgear CM400 cablemodem via curl
curl -s -u admin:password 'http://192.168.100.1'$(curl -s -u admin:password http://192.168.100.1/RouterStatus.htm | grep id=[0-9] | cut -d'"' -f2) --data 'buttonSelect=2&wantype=dhcp&enable_apmode=0' > /dev/null
@JoshCheek
JoshCheek / ruby-command-line-fu.md
Last active September 13, 2024 20:26
Ruby command line fu

Ruby in place of sed / awk

One of Ruby's major influences was Perl, leaving well equipped to replace bash, sed, and awk. Lets take a look at how to do that.

The -e flag

@JoshCheek
JoshCheek / walkers1.rb
Last active May 12, 2017 14:45
Walkers
# video @ https://vimeo.com/217144282
require 'graphics'
class Walkers < Graphics::Simulation
def initialize
super 800, 600, 24
color.default_proc = -> h, k { k }
@walkers = 50.times.map do
length = 15
colour = [
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <[email protected]>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@chrismccord
chrismccord / upgrade.md
Last active April 7, 2023 12:03
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

@JoshCheek
JoshCheek / .gitignore
Last active November 17, 2016 13:28
Symbolic simplification of a program / exploring Gödel's Incompleteness theorem and the halting problem
node_modules
@danielberkompas
danielberkompas / scheduler.ex
Created October 26, 2016 17:59
A simple mix task scheduler for Elixir apps
defmodule MyApp.Scheduler do
@moduledoc """
Schedules a Mix task to be run at a given interval in milliseconds.
## Options
- `:task`: The name of the Mix task to run.
- `:args`: A list of arguments to pass to the Mix task's `run/1` function.
- `:interval`: The time interval in millisconds to rerun the task.
@mislav
mislav / netflix.sh
Last active February 21, 2024 16:56
Watch Netflix as if you were in the US by proxying DNS through a DigitalOcean instance.
#!/bin/bash
set -e
droplet=netflix
interface=Wi-Fi
us_regions=( nyc1 nyc2 nyc3 )
random_region() {
echo ${us_regions[RANDOM % ${#us_regions[@]}]}
}
@vasanthk
vasanthk / System Design.md
Last active November 17, 2024 05:38
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?