Skip to content

Instantly share code, notes, and snippets.

@infinityhacks
infinityhacks / Steps.md
Created July 14, 2017 08:43 — forked from dblessing/Steps.md
Logstash + RabbitMQ HA attempt
  1. Configure RabbitMQ server clustering per https://www.rabbitmq.com/clustering.html.
  2. Configure at least one logstash agent to output to RabbitMQ. See config example:
output {
  rabbitmq {
    vhost => 'logstash'
    exchange => 'my_exchange'
    exchange_type => 'direct'
    host => 'logstashmq.example.com'
    key => 'my_key'
@infinityhacks
infinityhacks / routes.rb
Created October 16, 2017 10:44 — forked from 1c7/routes.rb
devise_for :users, controllers: {
registrations: "user/registrations",
omniauth_callbacks: 'omniauth_callback'
}
# sets the proxy cache path location, max size 2g
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# transfers the `Host` header to the backend
proxy_set_header Host $host;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
Add SPDY Support.
Add HTTP2 HPACK Encoding Support.
Add Dynamic TLS Record support.
Using: patch -p1 < nginx.patch
diff -uNr a/auto/modules b/auto/modules
--- a/auto/modules 2017-10-10 23:22:51.000000000 +0800
+++ b/auto/modules 2017-10-18 07:26:41.442669499 +0800
@@ -134,6 +134,7 @@
@infinityhacks
infinityhacks / bench.sh
Created January 30, 2018 03:41 — forked from TimothyYe/bench.sh
Bench test script
#!/usr/bin/env bash
#
# Description: Auto test download & I/O speed script
#
# Copyright (C) 2015 - 2016 Teddysun <i@teddysun.com>
#
# Thanks: LookBack <admin@dwhd.org>
#
# URL: https://teddysun.com/444.html
#

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

.modal.fade.modal-fade
.modal-dialog
.modal-content
.modal-header
%button.close{type:'button', data:{dismiss:'modal'}}
%span{aria:{hidden:'true'}}
%i.fa.fa-close
%span.sr-only Close
%h4.modal-title
.modal-body
@infinityhacks
infinityhacks / aacs.py
Created June 3, 2018 12:28 — forked from fffonion/aacs.py
Anti-anti-crawler scripts
import re
import time
mkcookie = lambda coo: ";".join(["%s=%s" % (k,v) for k,v in coo.iteritems()])
def autodetect(resp, ct, ht, cookie, headers, url):
__func = None
while 'set-cookie' in resp:
coostr = resp['set-cookie']
_session = re.findall('yunsuo_session_verify=(\w+)', coostr)
@infinityhacks
infinityhacks / Dockerfile
Created September 16, 2018 08:58 — forked from Rudis1261/Dockerfile
Rails Docker Setup
FROM ruby:2.3.1
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN apt-get install -y imagemagick
RUN mkdir /usr/local/rails-app
WORKDIR /usr/local/rails-app
ADD Gemfile Gemfile
ADD Gemfile.lock Gemfile.lock
RUN bundle install
@infinityhacks
infinityhacks / ttfb.sh
Created September 29, 2018 06:56 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \