Skip to content

Instantly share code, notes, and snippets.

View l1th1um's full-sized avatar

Andri Fachrur Rozie l1th1um

  • Bandung, Indonesia
View GitHub Profile
@l1th1um
l1th1um / logstash_mongodb.conf
Last active January 13, 2024 12:46
MongoDB to Elasticsearch using Logstash
input {
mongodb {
uri => 'mongodb://127.0.0.1:27017/db_name?ssl=false'
placeholder_db_dir => '/opt/logstash-mongodb/'
placeholder_db_name => 'logstash_sqlite.db'
collection => col_name
batch_size => 5000
}
}
filter {
@l1th1um
l1th1um / docker.sh
Created May 25, 2023 04:46
Docker Cheatsheet
#Update stretch repositories
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
@l1th1um
l1th1um / s3_laravel_cheatsheet
Last active May 22, 2023 03:24
S3 Laravel CheatSheet
$cloud = Storage::disk('s3');
$client = $cloud->getClient();
$bucket = 'bucket'; //Fill with Bucket Name
$path = 'path'; //Fill with Path (without http/https)
//Get Tag
$res = $client->getObjectTagging(['Bucket' => $bucket, 'Key' => $path]);
$res->get('TagSet');
@l1th1um
l1th1um / reverse_proxy.conf
Created April 9, 2022 16:11
Reverse Proxy Nginx for Docker Container
server {
listen 80;
listen [::]:80;
server_name __;
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
@l1th1um
l1th1um / honeyweb.conf
Created September 26, 2021 16:44
Logstash Configuration for Syncing MySQL Honeyweb Database to ELK Stack
input {
jdbc {
jdbc_driver_library => "/usr/share/logstash/logstash-core/lib/jars/mysql-connector-java-8.0.26.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://localhost:3306/MYSQL_DBNAME"
jdbc_user => MYSQL_USERNAME
jdbc_password => MYSQL_PASSWORD
jdbc_paging_enabled => true
tracking_column => "unix_ts_in_secs"
use_column_value => true
@l1th1um
l1th1um / honeyweb.json
Created September 26, 2021 16:22
Honeyweb Logstash ElasticSearch Template
{
"template": "honeyweb",
"version": 1,
"settings": {
"index.refresh_interval": "5s"
},
"mappings": {
"properties": {
"attackerip": {
"type": "ip"
@l1th1um
l1th1um / .p10k.zsh
Created July 19, 2021 11:04
p10k zsh Configuration
# Generated by Powerlevel10k configuration wizard on 2021-07-19 at 10:54 UTC.
# Based on romkatv/powerlevel10k/config/p10k-rainbow.zsh, checksum 23401.
# Wizard options: compatible, rainbow, unicode, 24h time, blurred heads, flat tails,
# 2 lines, disconnected, full frame, dark-ornaments, compact, concise, transient_prompt,
# instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with powerline prompt style with colorful background.
# Type `p10k configure` to generate your own config based on it.
#
@l1th1um
l1th1um / setup_oh_my_zsh.sh
Last active July 19, 2021 10:52
Setup Oh-My-ZSH Powerlevel and plugins
#!/bin/sh
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -ri 's/(ZSH_THEME=)\"(.*)\"/\1\"powerlevel10k\/powerlevel10k\"/' ~/.zshrc
sed -ri 's/(plugins=\(.*)(\))/\1 zsh-autosuggestions zsh-syntax-highlighting\)/' ~/.zshrc
source ~/.zshrc
@l1th1um
l1th1um / backup_mysql.sh
Created July 19, 2021 10:27
Backup MySQL Databases
#!/bin/bash
USER="root"
PASSWORD=""
databases=`mysql -u $USER -p$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
for db in $databases; do
if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] ; then
echo "Dumping database: $db"
@l1th1um
l1th1um / rijndael.py
Last active May 24, 2021 14:52
Python MCRYPT RIJNDAEL 128
from Crypto.Cipher import AES
import base64
import binascii
class RijndaelEncryptor(object):
def __init__(self, k=16):
self.k = k
def encrypt(self, text, input_key, input_iv):
aes = AES.new(input_key, AES.MODE_CBC, input_iv)