Skip to content

Instantly share code, notes, and snippets.

View ioquatix's full-sized avatar
⚖️
Let's make it scalable!

Samuel Williams ioquatix

⚖️
Let's make it scalable!
View GitHub Profile
@ioquatix
ioquatix / mysql-backup
Last active October 27, 2016 02:14
Simple MySQL backup script built on percona xtrabackup
#!/usr/bin/env ruby
# In order to use this script, you need a backup user:
# CREATE USER backup@localhost;
# GRANT SELECT, USAGE, PROCESS, RELOAD, CLIENT REPLICATION ON *.* TO backup@localhost;
require 'fileutils'
BACKUP_DIR = "/srv/mysql"
MYSQL = "/usr/bin/mysql"
% mysqladmin --help
mysqladmin Ver 9.1 Distrib 10.1.18-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Administration program for the mysqld daemon.
Usage: mysqladmin [OPTIONS] command command....
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf
The following groups are read: mysqladmin client client-server client-mariadb
GIT(1) Git Manual GIT(1)
NAME
git - the stupid content tracker
SYNOPSIS
git [--version] [--help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
@ioquatix
ioquatix / gist:ad60402d99cc5bf9b1fb0f8b4ffc142f
Last active August 25, 2017 03:29
MikroTik HEX Gr3 PPPoE ONT Configuration for New Zealand
# dec/12/2016 16:45:48 by RouterOS 6.37.3
# software id = RE4F-WKP7
#
/interface ethernet
set [ find default-name=ether2 ] name=ether2-master
set [ find default-name=ether3 ] master-port=ether2-master
set [ find default-name=ether4 ] master-port=ether2-master
set [ find default-name=ether5 ] master-port=ether2-master
/ip neighbor discovery
set ether1 discover=no
@ioquatix
ioquatix / aio.rb
Last active March 28, 2017 02:16
rough outline of fiber based concurrency
#!/usr/bin/env ruby
require 'fiber'
require 'nio'
module Async
end
class Async::Await
def initialize(ios, reactor)
#!/usr/bin/env ruby
require 'async'
require 'lightio'
def run_async(count = 10000)
start = Time.now
Async::Reactor.run do |task|
tasks = count.times.map do
#!/usr/bin/env ruby
require 'async/io'
require 'async/http/server'
require 'async/dns'
def print_server
Async::Reactor.run do |task|
task.async do
http_endpoints = Async::IO::Endpoint.tcp('localhost', 8081, reuse_port: true)
0493b1a5afb2044a2bf3b1eb3d7268cbba9027a2d550660e78bbf04e361a26babbd906bf6c91044097d73b2e4927e1d1c532bdf11e6e17bf8866935351de3f9287
@ioquatix
ioquatix / atom.css
Created March 15, 2018 09:57
Switch off ligatures on current lines, in quoted strings, and in regular expressions
* {
-webkit-font-smoothing: antialiased;
}
atom-text-editor {
text-rendering: optimizeLegibility;
}
atom-text-editor.editor .syntax--comment {
font-style: normal !important;
@ioquatix
ioquatix / async-slack.rb
Last active April 16, 2022 22:28
Make slack-api great again
# This is used in production, but I've extracted everything here, so this particular code is untested, but should work.
gem 'async-http-faraday'
gem 'async-websocket'
gem 'slack-api'
require 'slack'
require 'async/http/url_endpoint'