Skip to content

Instantly share code, notes, and snippets.

View pokle's full-sized avatar

Tushar Pokle pokle

View GitHub Profile
@pokle
pokle / silver-searcher-install.sh
Created December 15, 2015 11:17
Get the silver searcher on redhat / centos
#!/usr/bin/env bash
set -e
set -x
sudo yum -y groupinstall "Development Tools"
sudo yum -y install pcre-devel xz-devel
git clone https://github.com/ggreer/the_silver_searcher
cd the_silver_searcher/
#!/usr/bin/env perl
#
# Major device number counts of the home files at http://sylab-srv.cs.fiu.edu/doku.php?id=projects:iodedup:start
#
# run like this: perl counts.pl homes-*
use strict;
my %count = ();
@pokle
pokle / nginx.conf
Created August 21, 2015 03:45
Minimal nginx configuration showing some basic things
# Save this as nginx.conf
# stop with: sudo nginx -s stop
# start with: sudo nginx -p . -c nginx.conf
events {
worker_connections 1024;
}
http {
server {
events {
worker_connections 1024;
}
http {
server {
listen 80;
location = / {
return 302 http://localhost/a/b/c;
@pokle
pokle / login.html
Created June 4, 2015 06:02
Super simple login form
<!DOCTYPE html>
<html>
<head>
<title>CSSO</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<form class="form" action="/login">
@pokle
pokle / pepl.pl
Created February 21, 2015 08:17
Tiny perl repl
#!/usr/bin/env rlwrap perl
$_='"Welcome to the perl repl"';
do {
$result = eval($_);
print $@ if ($@);
print $result, "\n" if defined $result;
print 'pepl> ';
} while (<>);
@pokle
pokle / Dockerfile
Created April 16, 2014 04:45
Run ssh server inside a Centos/Redhat Docker container
# ssh server
# Don't forget to run '/usr/sbin/sshd -D' if you actually want to ssh into this container
RUN yum install -y openssh-server
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
RUN ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
ADD src/sshd/sshd_config /etc/ssh/sshd_config
RUN echo root:welcome1 | chpasswd
@pokle
pokle / list-dir.clj
Created March 17, 2014 01:21
How to list a directory in Clojure
(map str (file-seq (clojure.java.io/as-file "/some/directory")))
@pokle
pokle / gist:9271432
Last active August 22, 2017 16:01
Automatically mount the EC2 ephermal SSDs as raid0 on Ubuntu

Launch your EC2 EBS instance with two SSDs on the second and third slots (after the root EBS volume), with this in your userdata:

#!/usr/bin/env bash

umount /dev/xvdb
umount /dev/xvdc
apt-get install mdadm -y
mkdir /u01

cat > /etc/init/mount-ephermal-ssd.conf <

@pokle
pokle / install-oracle-jdk.sh
Last active August 29, 2015 13:56
Install Oracle JDK on Centos / Redhat
wget --no-check-certificate \
--no-cookies \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" \
"http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.rpm" \
--output-document /tmp/jdk.rpm &&
yum install -y /tmp/jdk.rpm