Skip to content

Instantly share code, notes, and snippets.

non7top non7top

Block or report user

Report or block non7top

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View dump_http_headers.sh
# https://serverfault.com/a/633452
stdbuf -oL -eL /usr/sbin/tcpdump -A -s 10240 -i lo "tcp port 82 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | egrep -a --line-buffered ".+(GET |HTTP\/|POST )|^[A-Za-z0-9-]+: " | perl -nle 'BEGIN{$|=1} { s/.*?(GET |HTTP\/[0-9.]* |POST )/\n$1/g; print }'
@non7top
non7top / check_http_wget
Created Feb 12, 2019
nagios site check, uses curl
View check_http_wget
#!/bin/bash
exec 2>&1
[ -d /dev/shm -a -w /dev/shm ] && export TMPDIR=/dev/shm
# Parsing Input Parameters {{{
#####################################################################
allparams=$*
g_myname_pid=$$
@non7top
non7top / recode.sh
Created Sep 8, 2018 — forked from cstroie/recode.sh
Recode MP3 files with normalization
View recode.sh
#!/bin/bash
#
# recode
#
# Copyright 2011 Costin STROIE <costinstroie@eridu.eu.org>
#
@non7top
non7top / super-tip.txt
Created Jan 18, 2018 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
View super-tip.txt
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
View nginx-lua-s3.nginxconf
location ~* ^/s3/(.*) {
set $bucket '<REPLACE WITH YOUR S3 BUCKET NAME>';
set $aws_access '<REPLACE WITH YOUR AWS ACCESS KEY>';
set $aws_secret '<REPLACE WITH YOUR AWS SECRET KEY>';
set $url_full "$1";
set_by_lua $now "return ngx.cookie_time(ngx.time())";
set $string_to_sign "$request_method\n\n\n\nx-amz-date:${now}\n/$bucket/$url_full";
set_hmac_sha1 $aws_signature $aws_secret $string_to_sign;
set_encode_base64 $aws_signature $aws_signature;
View Bootstrap-EC2-Windows-CloudInit.ps1
# install 7-zip, curl and vim
# (Windows 2012 comes with .NET 4.5 out-of-the-box)
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2012 64bits AMIs provided by Amazon (eu-west-1 ami-a1867dd6)
#
# Inject this as user-data of a Windows 2012 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@non7top
non7top / WinRM-Insecure-Bootstrap.ps1
Created Dec 12, 2017 — forked from thomasalley/WinRM-Insecure-Bootstrap.ps1
Quickly bootstrap a Windows host to allow insecure connections. Also creates an HTTPS listener with a self-signed cert.
View WinRM-Insecure-Bootstrap.ps1
winrm quickconfig -q -force
Enable-psremoting –force
Set-executionpolicy bypass –force
winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
winrm set winrm/config/client '@{TrustedHosts="*"}'
# Configuration Warning:
View assume-role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
@non7top
non7top / pre-commit
Created Sep 14, 2017 — forked from jamtur01/pre-commit
A Terraform validation and formatting pre-commit hook
View pre-commit
#!/usr/bin/env bash
set -e
# Formats any *.tf files according to the hashicorp convention
files=$(git diff --cached --name-only)
for f in $files
do
if [ -e "$f" ] && [[ $f == *.tf ]]; then
#terraform validate `dirname $f`
terraform fmt $f
View zero_logs.sh
#! /bin/bash
cat /dev/null > /var/log/anaconda.ifcfg.log
cat /dev/null > /var/log/anaconda.log
cat /dev/null > /var/log/anaconda.program.log
cat /dev/null > /var/log/anaconda.storage.log
cat /dev/null > /var/log/anaconda.syslog
cat /dev/null > /var/log/anaconda.xlog
cat /dev/null > /var/log/anaconda.yum.log
cat /dev/null > /var/log/audit/audit.log
cat /dev/null > /var/log/boot.log
You can’t perform that action at this time.