Skip to content

Instantly share code, notes, and snippets.

View kyxap1's full-sized avatar

Oleksandr Kukhar kyxap1

View GitHub Profile
Script to install yum on a retarded Centos 5.2 box:
rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/python-sqlite-1.1.7-1.2.1.i386.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/rpm-python-4.4.2.3-18.el5.i386.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/python-urlgrabber-3.1.0-5.el5.noarch.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/m2crypto-0.16-6.el5.6.i386.rpm \
@m0n5t3r
m0n5t3r / gist:1006281
Created June 3, 2011 12:50
set x-forwarded-ssl correctly (nginx, http+https in the same config)
set $ssl off;
if ($scheme = https) {
set $ssl on;
}
proxy_set_header X-Forwarded-Ssl $ssl;
@cosimo
cosimo / parse-options.sh
Created September 21, 2012 09:31
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
OPTS=`getopt -o vhns: --long verbose,dry-run,help,stack-size: -n 'parse-options' -- "$@"`
if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
echo "$OPTS"
@KylePDavis
KylePDavis / sh_env_var_opts.sh
Last active September 14, 2023 01:26
Simple bash shell script templates. There are two versions: 1) simple env var based options, and 2) with added command line argument parsing and error handling.
#!/bin/bash -e
# A SHORT DESCRIPTION OF YOUR SCRIPT GOES HERE
# USAGE:
# DESCRIPTION OF ENV VARS HERE
###############################################################################
set -e # exit on command errors (so you MUST handle exit codes properly!)
set -o pipefail # capture fail exit codes in piped commands
#set -x # execution tracing debug messages
# Get command info
@yorkxin
yorkxin / README.md
Last active October 27, 2020 12:17
Amazon S3 Redirect Rules Generator

Amazon S3 Redirect Rules Generator

A Ruby script to generate simple Amazon S3 Redirection Rules XML file.

Update: There is an app for that now! Use Amazon S3 Redirector (Web app) and you can generate the XML without any knowledge about Ruby. Thanks to @rainforestapp. BTW, It's open source too.

Dependencies

  • Nokogiri
@willurd
willurd / web-servers.md
Last active July 12, 2024 11:21
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@owainlewis
owainlewis / java7.yml
Created July 24, 2013 10:45
Install Java 7 with Ansible on Ubuntu Linux
---
- name: ensure required packages are installed for Java 7
apt: name=$item state=latest update_cache=yes
with_items:
- python-software-properties
- name: Add Java repository to sources
action: apt_repository repo='ppa:webupd8team/java'
@nakamuray
nakamuray / yaml2dot.py
Created November 26, 2013 04:19
YAML to dot translator
#!/usr/bin/python
# vim: fileencoding=utf-8
u'''Translate YAML written text to graphviz dot language
Input YAML text like below:
---
employee:
- name
- age
@denji
denji / README.md
Last active April 25, 2023 21:48
Take a list of CIDR address blocks and combine them, for example, 192.168.0.0/24 and 192.168.1.0/24 gives 192.168.0.0/23. I usually use "list-iana-reserved-ranges | aggregate-cidr-addresses" to get a list of blocks to not report with firewall log processing.
@rtfpessoa
rtfpessoa / java-8-ami.md
Last active March 21, 2022 14:46
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami