Skip to content

Instantly share code, notes, and snippets.

@dogukancagatay
dogukancagatay / send_test_email.py
Created April 7, 2021 15:43
Send test e-mail with Python smtplib
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
s = smtplib.SMTP(host="localhost", port=25)
# s.starttls() # Enable if your mail server uses TLS
# s.login("user.name@example.local", "mysupersecretpassword") # Enable if using user authentication
@dogukancagatay
dogukancagatay / set-git-config-profile.sh
Last active March 21, 2021 15:27
Conditionally change your git-config profile based on directory using includeIf option.
#!/usr/bin/env bash
PROFILE_NAME="$1"
CONFIG_FILE="$HOME/.gitconfig-$PROFILE_NAME"
function show_usage() {
echo "Usage:"
echo -e "\tset-git-config-profile.sh <profile-name> : Sets the profile for current directory"
echo -e "\tset-git-config-profile.sh -r : Unsets any profile for current directory"
}
@dogukancagatay
dogukancagatay / .gitignore
Last active October 16, 2020 23:04
Configurable Marlin Firmware build script (with PlatformIO CLI) for BigTreeTech SKR Mini E3 2.0 board
dist
Configurations
Marlin
BIGTREETECH-TouchScreenFirmware
@dogukancagatay
dogukancagatay / backup_mongo.sh
Created September 9, 2020 09:34
MongoDB backup script with docker #docker #mongodb #backup
#!/usr/bin/env bash
MONGO_URL="mongodb://192.168.1.100/"
BACKUP_PARENT_DIR="/tmp/mongo-backups"
BACKUP_DIR="mongobackup-`date +%Y-%m-%d-%H-%M-%S`"
BACKUP_COLLECTION_PARALLELISM="4"
@dogukancagatay
dogukancagatay / daemon.json
Last active April 9, 2024 07:08
Sample Docker daemon.json
{
"data-root": "/mnt/disk1/docker",
"storage-driver": "overlay2",
"insecure-registries" : [
"192.168.1.200:5000"
],
"dns": [
"192.168.1.1"
],
"registry-mirrors" : [
dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
dnf install -y cuda
cat <<EOF > /etc/profile.d/cuda.sh 
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
EOF
@dogukancagatay
dogukancagatay / user_auth.py
Created June 10, 2020 06:16
Tweepy Twitter API
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
try:
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
@dogukancagatay
dogukancagatay / KeyDB with Docker.md
Last active June 5, 2024 23:01
Basic KeyDB Configuration with Docker

KeyDB with Docker

Migration from Redis

Connect to your keydb server new-keydb-server-1

keydb-cli -h new-keydb-server-1
@dogukancagatay
dogukancagatay / HA Proxy With Docker.md
Last active September 3, 2022 18:22
Basic HAProxy Setup for Multiple Services with Docker

Basic HAProxy Setup for Multiple Services with Docker

  • RabbitMQ
  • Redis
  • Web Server/Ingress
@dogukancagatay
dogukancagatay / Keepalived Configuration.md
Last active June 8, 2020 06:18
Basic Keepalived Configuration

Keepalived Configuration

yum install -y keepalived