Skip to content

Instantly share code, notes, and snippets.

@c0mpiler
c0mpiler / my-es-test.sh
Last active March 8, 2018 20:05
ElasticSearch settings
root@harsha:~# curl -XPUT 'localhost:9200/_settings?pretty' -H 'Content-Type: application/json' -d' { "index": { "refresh_interval": "30s" } } '
{
"acknowledged" : true
}
root@harsha:~# curl -XPUT 'localhost:9200/_settings?pretty' -H 'Content-Type: application/json' -d' { "index": { "number_of_replicas": "0" } } '
{
@c0mpiler
c0mpiler / install-docker-rhel7.sh
Created March 6, 2018 19:47
Install Docker CE on RHEL
# pre-requisite for container-selinux-2.9-4.el7.noarch.rpm
sudo yum install policycoreutils-python
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.21-1.el7.noarch.rpm
sudo rpm -i container-selinux-2.21-1.el7.noarch.rpm
#Set up the Docker CE repository on RHEL:
sudo yum install -y yum-utils
sudo yum install -y device-mapper-persistent-data lvm2
sudo yum-config-manager --enable rhel-7-server-extras-rpms
@c0mpiler
c0mpiler / iTerm2.md
Created February 16, 2018 21:06
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
Fullscreen + Enter
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
Go to Window + Option + Number
Go to Split Pane by Direction + Option + Arrow
@c0mpiler
c0mpiler / HelloQbit.java
Created February 13, 2018 23:50
HelloQbit
import HelloWorldService;
import io.advantageous.qbit.admin.ManagedServiceBuilder;
import io.advantageous.qbit.http.request.HttpBinaryResponse;
import io.advantageous.qbit.http.request.HttpResponseBuilder;
import io.advantageous.qbit.http.request.HttpTextResponse;
import io.advantageous.qbit.http.request.decorator.HttpBinaryResponseHolder;
import io.advantageous.qbit.http.request.decorator.HttpResponseDecorator;
import io.advantageous.qbit.http.request.decorator.HttpTextResponseHolder;
@c0mpiler
c0mpiler / file_handles.sh
Last active January 22, 2018 18:20
Monitor the number of file handles opened by the web-app and handle as needed
# run this script as a cron job or using watch
#
# e.g:
# Using 'watch' - to run the script every 5 mins
# # watch -n 300 ./file_handles.sh
#
# Using a cron job to run every 5 mins. Run
# # crontab –e
# then add the following line to the editor
# '*/10 * * * * /home/hvkrishn/file_handles.sh'
@c0mpiler
c0mpiler / Utils.java
Last active January 17, 2018 20:25
Print File descriptors count
package com.ibm.labbook.utils;
import com.ibm.lang.management.ExtendedOperatingSystem;
import com.ibm.lang.management.ManagementUtils;
import com.ibm.lang.management.OperatingSystemMXBean;
import com.ibm.lang.management.UnixOperatingSystemMXBean;
@SuppressWarnings("restriction")
public class SystemUtil{
@c0mpiler
c0mpiler / add-rabbitmq-admin.sh
Last active October 13, 2017 03:04
Create a new RabbitMQ user as 'administrator'
#user: c0mpiler
#password: testpwd123
rabbitmqctl add_user c0mpiler testpwd123
rabbitmqctl set_user_tags c0mpiler administrator
rabbitmqctl set_permissions -p / c0mpiler ".*" ".*" ".*"
curl -i -u c0mpiler:testpwd123 http://localhost:15672/api/whoami
@c0mpiler
c0mpiler / chrome-different-tz.sh
Created January 9, 2017 00:17
Open chrome with a spoofed timezone set
#!/usr/bin/env bash
# chrome-different-tz
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@c0mpiler
c0mpiler / reclaimWindows10.ps1
Created January 8, 2017 00:37
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <[email protected]>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
cd /proc
for pid in [0-9]*
do
echo "PID = $pid with $(ls /proc/$pid/fd/ | wc -l) file descriptors"
done