Skip to content

Instantly share code, notes, and snippets.

View behroozam's full-sized avatar
😁
teheeee

Behrouz Hasanbeygi behroozam

😁
teheeee
View GitHub Profile
@behroozam
behroozam / awk split huge file
Created July 23, 2017 13:03
how to split huge text file with awk flag
#when you have no space left on your server and your link is weak you hace no choice to remove or compress files . of course you can use awk in normal way but somtimes you log or text file contain messy things and its hard to select all pattern between start of file and end
# i use awk flag(on and off) but in normal timestamp(clear with no messy things) you can use split option to extract log
#!/bin/bash
awk '/2017-03-01/{flag=1}flag;/2017-04-01/{flag=0}' huge.log | gzip > 2017-03
@behroozam
behroozam / curl bash readline variable
Created July 23, 2017 13:07
read text file and call it with curl
while IFS= read -r line;do
fields=($(printf "%s" "$line"|cut -d' ' --output-delimiter=' ' -f1-))
echo "http://127.0.0.1:5000/services/rest/zzz/subscribe-withactor?mobilenum="${fields[1]}"&service_id="${fields[2]}"&shortcode="${fields[0]}"&message=&actor=MO;"
done < yourfile
version: '2'
services:
ocserv:
image: tommylau/ocserv
ports:
- '443:443'
environment:
CA_CN: VPN CA
CA_ORG: Big Corp
CA_DAYS: '9999'
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install --setopt=obsoletes=0 \
docker-ce-17.03.2.ce-1.el7.centos.x86_64 \
docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch
@behroozam
behroozam / gist:54ffd583f10c453f92354eae5b5e4b6b
Created April 8, 2018 07:52
php deoplyer for deploy docker-compose laravel project in test and production server
<?php
namespace Deployer;
require 'recipe/common.php';
const PRODUCTION_ENV = 'production';
const TEST_ENV = 'test';
// Project name
set('application', 'my_project');
@behroozam
behroozam / docker-compose.yml
Created July 14, 2018 10:24
rancher elasticsearch 6.3.1
version: '2'
volumes:
esdata:
external: true
driver: local
edatanode:
external: true
driver: local
services:
elasticsearch:
@behroozam
behroozam / docker-compose.yml
Created July 14, 2018 10:24
rancher elasticsearch 6.3.1
version: '2'
volumes:
esdata:
external: true
driver: local
edatanode:
external: true
driver: local
services:
elasticsearch:
@behroozam
behroozam / Dockerfile
Created August 5, 2018 12:39
dockerfile for coustom logstash image
FROM docker.elastic.co/logstash/logstash:6.3.2
RUN rm -f /usr/share/logstash/pipeline/logstash.conf
ADD ./pipeline/ /usr/share/logstash/pipeline/
USER root
RUN chown logstash:root /usr/share/logstash/pipeline/logstash.conf && chmod 644 /usr/share/logstash/pipeline/logstash.conf
USER logstash
@behroozam
behroozam / logstash.conf
Created August 5, 2018 12:49
logstash to elasticssearch gelf example
input {
gelf {
port => 12201
type => gelf
}
}
filter {
grok {
match => { "message" => "%{IPORHOST:remote_addr} - %{USERNAME:remote_user} \[%{HTTPDATE:time_local}\] \"%{DATA:request}\" %{INT:status} %{NUMBER:bytes_sent} \"%{DATA:http_referer}\" \"%{DATA:http_user_agent}\"" }
@behroozam
behroozam / deployment-example-api
Created September 12, 2018 11:46
rancher v2 kubernetes create or update a service example api with curl
curl -k -X PUT \
-u "user-token:password" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d "{\"containers\":[{\"allowPrivilegeEscalation\":false,\"image\":\"YourImage\",\"imagePullPolicy\":\"Always\",\"initContainer\":false,\"name\":\"bisthijdah-webserver\"}]}" \
"yourbaseURL/v3/project/yourprojectid/workloads/deployment:namespace:yourappname"