Skip to content

Instantly share code, notes, and snippets.

View sashati's full-sized avatar
👨‍💻

Saeed Shariati sashati

👨‍💻
View GitHub Profile
@sashati
sashati / kafka-docker-compose.yml
Last active December 31, 2023 16:22
Kafka stack simple docker-compose for testing purpose: Kafka (No zookeeper), Schema Registry, Kafka UI, RedPanda Console, kcat
---
version: '2'
services:
broker:
image: confluentinc/cp-kafka:7.3.3
hostname: broker
container_name: broker
ports:
- "9092:9092"
- "9101:9101"
@sashati
sashati / message.html
Last active September 24, 2017 13:11
REST call and show message on action with JQuery
<header>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="success-alert" class="alert alert-success alert-dismissible col-xs-8 text-center " style="display: none;">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="icon fa fa-check"></i> Changes saved!
</div>
</header>
@sashati
sashati / post_to_slack.sh
Last active November 25, 2017 07:29
Hook on log files and send message to Slack via terminal
#!/bin/sh
function post_to_slack () {
SLACK_URL=https://hooks.slack.com/services/....
case "$1" in
INFO)
SLACK_ICON=':slack:'
;;
WARN)
@sashati
sashati / docker-compose.yml
Created March 25, 2017 07:35
Run Kafka server with docker-compose
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper
environment:
- ZOOKEEPER_CLIENT_PORT=2181
ports:
- "2181:2181"
kafka:
@sashati
sashati / Dockerfile
Last active March 25, 2017 06:22
Dockerfile to install Oracle JAVA in Docker
FROM ubuntu:16.04
MAINTAINER XXX
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -yqq install \
software-properties-common \
python-software-properties \
ca-certificates \
netcat \
nano \
@sashati
sashati / .bashrc
Last active February 7, 2017 08:11
A beautiful and colorful prompt in bash
if [ "$color_prompt" = yes ]; then
PS1="[\[$(tput sgr0)\]\[\033[38;5;119m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\] @ \[$(tput sgr0)\]\[\033[38;5;14m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;226m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]] \[$(tput sgr0)\]\[\033[38;5;75m\]\t\[$(tput sgr0)\]\[\033[38;5;15m\] {\[$(tput sgr0)\]\[\033[38;5;1m\]\$?\[$(tput sgr0)\]\[\033[38;5;15m\]}\n\[$(tput sgr0)\]\[\033[38;5;7m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]"
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
@sashati
sashati / gist:d65d976cf57305329db3
Last active August 29, 2015 14:16
Measure energy consumption of an application
# To meausre energy consumption of an application, we can use Intel PCM Tools.
sudo pcm.x -- filename arguments
@sashati
sashati / install−tmux.sh
Last active August 29, 2015 14:11
Install tmux on non-root systems
wget http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz
tar-xvf tmux-1.9a.tar.gz
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure
make
cd ../tmux-1.9a
@sashati
sashati / sgrep.sh
Last active August 29, 2015 13:56
A simple and fast method to grep from folders in colorful output.
#!/bin/sh
sgrep ()
{
if [ "${3}" ]; then
if [ -n "${2}" ]; then
find . \( -name "${3}" -prune \) -o -name "*" -exec grep -i --color -Hn "${1}" {} 2>/dev/null \;
else
find ${2} \( -name "${3}" -prune \) -o -name "*" -exec grep -i --color -Hn "${1}" {} 2>/dev/null \;
fi
@sashati
sashati / gist:9005388
Created February 14, 2014 17:38
Read list of files from a file and copy all of the to a folder in Linux
cat fileList.log | sed 's/.*/"&"/' | xargs cp -t folderName