Skip to content

Instantly share code, notes, and snippets.

@salmon5
salmon5 / nginx-try_files.md
Created September 9, 2018 05:36 — forked from snakevil/nginx-try_files.md
Nginx try_files 的美感问题

Nginx try_files 的美感问题

Nginx try_files 指令自实现之日启,风靡至今。单纯说功能实现地话,确实能够快速地适配各种需要场景,省掉了大段的 ifset。但相应的 URL 拼写格式,就真地不忍直视了。

2016 年 11 月 21 日修订 REQUEST_METHOD 被改变地问题。

丢失的 301 跳转

# Pull the necessary images:
docker pull nathanleclaire/curl:latest
docker pull openjdk:8u111-jre-alpine

# Start the controller container, note that it has RW access to the Docker API socket:
docker run \
  -ti \
  --rm \
@salmon5
salmon5 / Dockerfile
Created June 26, 2019 15:18 — forked from christianberg/Dockerfile
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
@salmon5
salmon5 / bgpd.conf
Created October 2, 2020 02:39 — forked from heri16/bgpd.conf
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
@salmon5
salmon5 / nchttpd
Created December 8, 2020 10:47 — forked from captainwasabi/nchttpd
Smallest webserver
#!/bin/bash
#usage: nchttpd port "cmd"
# port - port number to listen on for requests (if port < 1024 use sudo)
# cmd - command to execute when a request comes in, ex> "cat /var/www/index.html"
#
#example:
# $nchttpd 1500 "cat /var/www/index.html"
#
while true; do
echo "HTTP/1.1 200 OK\r\n $($2)" | nc -lp $1 -q 1 &
@salmon5
salmon5 / watch-unix-socket.stp
Created May 4, 2021 14:55 — forked from robbmanes/watch-unix-socket.stp
Systemtap script to watch UNIX socket input
/*
* watch_unix_socket.stp
*
* This is a simply more modern version of the script found here:
* https://sourceware.org/systemtap/wiki/WSunixSockets
*
* The first argument is the location of the file descriptor for a UNIX socket.
* To find this address, for example, for the Docker socket run:
*
* # lsof 2>&1 | awk '/docker.sock/ {print $7}' | grep -v '0t0' | sort -u
@salmon5
salmon5 / request.sh
Created May 7, 2021 07:47 — forked from nuxlli/unix_socket_request.sh
Examples of http request (in unix domain socket) with bash and [nc|socat]
#!/bin/bash
# References
# http://www.computerhope.com/unix/nc.htm#03
# https://github.com/daniloegea/netcat
# http://unix.stackexchange.com/questions/26715/how-can-i-communicate-with-a-unix-domain-socket-via-the-shell-on-debian-squeeze
# http://unix.stackexchange.com/questions/33924/write-inside-a-socket-open-by-another-process-in-linux/33982#33982
# http://www.linuxjournal.com/content/more-using-bashs-built-devtcp-file-tcpip
# http://www.dest-unreach.org/socat/
# http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
@salmon5
salmon5 / tcp_conn_blaster.py
Created May 14, 2021 04:56 — forked from robbmanes/tcp_conn_blaster.py
Script that sets up a server to accept connections and a client to flood the server with connections.
import logging
import socket
import sys
import threading
import time
CLIENT_CONN_ADDR="127.0.0.1"
CLIENT_NUM_CONNS=10
SERVER_PORT=8888
SERVER_SYN_BACKLOG=128
@salmon5
salmon5 / unix-socket-checker.py
Created May 14, 2021 04:57 — forked from robbmanes/unix-socket-checker.py
A python script that attempts to connect to a UNIX socket. This is useful when verifying if a container can reach a host socket, or has permissions issues with your current settings.
#!/usr/bin/python
import os
import sys
import time
import logging
import socket
def check_unix_socket():
@salmon5
salmon5 / RH342.md
Created June 11, 2021 13:49 — forked from luckylittle/RH342.md
Red Hat RH342 Notes

Red Hat Enterprise Linux Diagnostics & Troubleshooting (RH342)

Last update: Fri Jul 26 08:23:20 UTC 2019 by @luckylittle


1. Troubleshooting principles

2. Generic issues