Skip to content

Instantly share code, notes, and snippets.

View eXtrem0us's full-sized avatar

Mehdi Hamidi eXtrem0us

View GitHub Profile
@eXtrem0us
eXtrem0us / docker-compose.yml
Created July 11, 2020 04:24
Metabase with Postgres
version: '3.6'
services:
metabase:
image: metabase/metabase:latest
container_name: metabase
#restart: always
deploy:
resources:
limits:
memory: 4G
@eXtrem0us
eXtrem0us / docker-compose.yml
Created February 22, 2020 21:51
Zulip Server Configuration
version: '2'
services:
database:
image: 'zulip/zulip-postgresql:10'
environment:
POSTGRES_DB: 'zulip'
POSTGRES_USER: 'zulip'
# Note that you need to do a manual `ALTER ROLE` query if you
# change this on a system after booting the postgres container
# the first time on a host. Instructions are available in README.md.
@eXtrem0us
eXtrem0us / nginx.conf
Last active April 15, 2024 13:47
Nginx Image Filter with Caching for Upstream
########################################################################################################
# This config enables us to:
# - Resize
# - Rotate
# ...the resident images on an upstream server, with Nginx Server in our hand, On the fly!
# - Just by using arbitrary Query Parameters
# ...and
# - Cache the transformed image by address.
#
# Well, I got the Idea from https://stumbles.id.au/nginx-dynamic-image-resizing-with-caching.html
@eXtrem0us
eXtrem0us / phantomstress.sh
Created January 29, 2019 10:25
stress test using phantomjs
#!/bin/bash
Requests=$1
Concurrency=$2
URL=$3
CheckInterval=0
for r in $(seq $Requests)
do
#!/bin/bash
##
while true
do
proxychains curl -s https://bonbast.com | lynx --dump --stdin|grep USD|awk '{print $5}'
sleep 60
done
@eXtrem0us
eXtrem0us / onebackup.sh
Created March 18, 2018 14:34
Backup your OpenNebula images in one go
#!/bin/bash
#
# This script backs up your opennebula images to compressed qcow2 in one go.
# You may need to login through oneadmin user.
#
TargetDir="./"
for vmimage in $(seq 0 3)
do
imgname="$(oneimage show $vmimage|grep NAME|cut -d: -f2|tr -d ' ')"
imgpath="$(oneimage show $vmimage|grep SOURCE|tr -s ' '|cut -d' ' -f3)"
@eXtrem0us
eXtrem0us / csfaddport.sh
Last active December 26, 2017 13:32
Allowing TCP/UDP ports through CSF Firewall easily
#!/bin/bash
######
#$1<--->Method:::TCP_IN,TCP_OUT,UDP_IN,UDP_OUT
#$2<--->Port Number
[ -z "$2" ] && echo "Usage: addportcsf.sh Method PortNumber" && exit 1
csfconfpath="/etc/csf/csf.conf"
[ ! -w "$csfconfpath" ] && echo "CSF config file could not be modified or not found." && exit 1
portlist="$(grep "\ *$1.*\"$" $csfconfpath|cut -d\" -f2)"
occurance=false
for i in $(echo $portlist|tr , "\n")
@eXtrem0us
eXtrem0us / overalinfo.sh
Created August 27, 2017 11:49
get essential info from remote hosts
#!/bin/bash
USEPRIVKEY="-i ~/.ssh/open.key"
#Put your server hostnames here:
for line in {server1,server2,server3}
do
echo "$line:"
echo -n "CPU Cores:"
ssh -q $USEPRIVKEY $line "cat /proc/cpuinfo | grep processor | wc -l"
@eXtrem0us
eXtrem0us / bench.sh
Created August 19, 2017 21:10
Benchmark of Network and Disk thruput in a cloud env
#!/bin/bash
while read -r line
do
wget -q -t0 $line -O /dev/null -o /dev/null &
while [ $(ps -e|grep wget|wc -l) -gt 8 ]
do
sleep 1
done
done < list.txt
@eXtrem0us
eXtrem0us / dateformatchanger.py
Last active March 18, 2017 15:31
This python code is written to be used in very specific and personal manner
#!/usr/bin/python
#
# This Code changes lines like:
# "Mar 14, 2017 1:34 PM",blahblahblah
# to This one:
# "2017-03-14T13:34",blahblahblah
#
monthlist={\
'Jan':'01',\
'Feb':'02',\