Skip to content

Instantly share code, notes, and snippets.

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.

@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
#
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 @@
# 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
@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'
}
@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 / purge-multi.lua
Created May 15, 2017 16:00 — forked from titpetric/purge-multi.lua
Delete NGINX cached items with a PURGE with wildcard support
-- Tit Petric, Monotek d.o.o., Tue 03 Jan 2017 06:54:56 PM CET
--
-- Delete nginx cached assets with a PURGE request against an endpoint
-- supports extended regular expression PURGE requests (/upload/.*)
--
function file_exists(name)
local f = io.open(name, "r")
if f~=nil then io.close(f) return true else return false end
end
@infinityhacks
infinityhacks / monit.conf
Created March 9, 2017 05:56 — forked from raminv80/monit.conf
PPTP auto reconnect with Monit
...
#assuming the host behind vpn has local ip of 192.168.1.2
check host my_host_behind_vpn with address 192.168.1.2
# create a shell script at /usr/local/bin/start_pppd.sh
# Add your vpn connection setup there
# example conect of this file can be:
# pppd call my-vpn #to connect to pptp client
# sleep 5 #wait few seconds for connection to start
# route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 dev ppp0 # route your traffic
start program "/usr/local/bin/start_pppd.sh"
@infinityhacks
infinityhacks / nginx.conf
Created July 26, 2016 05:22 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@infinityhacks
infinityhacks / monitrc
Created July 12, 2016 08:30 — forked from 3rd-Eden/monitrc
monit nodejs deployment
###############################################################################
## Includes
###############################################################################
##
## It is possible to include additional configuration parts from other files or
## directories.
#
# include /etc/monit.d/*
#
#