Skip to content

Instantly share code, notes, and snippets.

View non7top's full-sized avatar

non7top non7top

  • Bakı
  • 04:11 (UTC +04:00)
View GitHub Profile
@non7top
non7top / recode.sh
Created September 8, 2018 11:47 — forked from cstroie/recode.sh
Recode MP3 files with normalization
#!/bin/bash
#
# recode
#
# Copyright 2011 Costin STROIE <costinstroie@eridu.eu.org>
#
@non7top
non7top / super-tip.txt
Created January 18, 2018 19:11 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
@non7top
non7top / nginx-lua-s3.nginxconf
Created January 14, 2018 21:51 — forked from raucao/nginx-lua-s3.nginxconf
Nginx proxy to S3
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;
# 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 December 12, 2017 17:32 — 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.
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:
@non7top
non7top / assume-role-policy.json
Created September 20, 2017 09:47 — forked from clstokes/assume-role-policy.json
Example: Terraform IAM Role
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
@non7top
non7top / pre-commit
Created September 14, 2017 21:43 — forked from jamtur01/pre-commit
A Terraform validation and formatting pre-commit hook
#!/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
@non7top
non7top / zero_logs.sh
Created August 7, 2017 23:11
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
@non7top
non7top / test.sh
Created July 27, 2017 15:21
Bash, cehck file is older then given number of days
# seen on SO
__older="$(( $(date +%s) - $(stat -L --format %Y ${file} ) > (${__age}*60*60) ))"
@non7top
non7top / check_http_wget
Created April 12, 2017 17:26
check_http_wget
#!/bin/bash
exec 2>&1
[ -d /dev/shm -a -w /dev/shm ] && export TMPDIR=/dev/shm
# Parsing Input Parameters {{{
#####################################################################
allparams=$*