Skip to content

Instantly share code, notes, and snippets.

View flavius's full-sized avatar

Flavius Aspra flavius

View GitHub Profile
@flavius
flavius / iptableflip.sh
Created August 25, 2023 16:37 — forked from lewisd32/iptableflip.sh
Snippet of Unbounce script for restarting HAProxy with zero downtime
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866
@flavius
flavius / Jenkinsfile
Created May 8, 2017 13:22 — forked from chinshr/Jenkinsfile
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}
@flavius
flavius / fast.md
Created March 31, 2017 18:45 — forked from davidmarkclements/fast.md
Idea - Single Request SPA
@flavius
flavius / haproxy.cfg
Created March 22, 2016 09:02 — forked from GABeech/haproxy.cfg
Stack Exchange HAProxy
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
from collections import defaultdict
def toposort(graph):
"""http://code.activestate.com/recipes/578272-topological-sort/
Dependencies are expressed as a dictionary whose keys are items
and whose values are a set of dependent items. Output is a list of
sets in topological order. The first set consists of items with no
dependences, each subsequent set consists of items that depend upon
items in the preceeding sets.

100k Requests -- 100 concurrent clients

ab -n 100000 -c 100 -k http://127.0.0.1:1337/

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            1337

Document Path:          /
@flavius
flavius / git_intro.txt
Last active December 24, 2015 08:59 — forked from sarvsav/git_intro.txt
Introduction to git
What is git?
- git is basically, a version control system where you can collaborate with
other and work on your projects. Developed by Linus.
Advantages of using git over other version system?
- git maintains snapshot of your projects, while other SVN store the diff for every change.
- git uses SHA1, so data loss is almost impossible (checks for data integrity).
- git maintains the local database, so the search is faster as compare to other.
" HJKL repetition trap
" Barry Arthur, 2013-03-14
" depends on your :help 'updatetime setting
let g:cursor_moving = 0
function! TrapMovementKeys(key)
augroup CursorMoving
au!
autocmd CursorMoved * let g:cursor_moving = 1
<?php
/**
* File: database.class.php
* Super simple PDO class
*
* Author: Jeremy Morgan
* Author: Flavius Aspra <flavius@php.net>
*
* This is just a start. No error handling or parameterization yet
*/
<?php
$url = 'http://forum.antichat.ru/thread20301.html';
function getfile($url,$num) {
echo "$url";
$content = file_get_contents($url);
echo nl2br($content);
$fp = fopen($num.".txt", 'write');
fwrite($fp, nl2br($content));
fclose($fp);
return $content;