Skip to content

Instantly share code, notes, and snippets.

View sayz's full-sized avatar
🏠
Working from home

Sefa Yıldız sayz

🏠
Working from home
View GitHub Profile
import base64
from http.server import BaseHTTPRequestHandler, HTTPServer
# Base64 stringini JPEG dosyasına dönüştürme fonksiyonu
def base64_to_image(base64_string, image_path):
image_data = base64.b64decode(base64_string)
with open(image_path, 'wb') as file:
file.write(image_data)
# HTTP sunucusu için handler sınıfı
@sayz
sayz / curl_post_json.md
Created June 2, 2020 13:31 — forked from ungoldman/curl_post_json.md
post a JSON file with curl

How do you POST a JSON file with curl??

You can post a json file with curl like so:

curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION

so for example:

import csv
#! /usr/bin/env python3
#title :test_ldap_data.py
#description :read from ldif, write as csv
#author :Sefa Yıldız
#mail :XXXX
#date :01-04-2020
#==============================================================================
#ldif'i oku ve listeye at
@sayz
sayz / Documentation.md
Created December 18, 2019 14:35 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
file1 = open("wrong_ip.txt", encoding="utf-8")
wrongs = file1.readlines()
file2 = open("full_ip.txt", encoding="utf-8")
full_ip = file2.readlines()
file3 = open("match_ip.txt", "w")
match_full = [0,1,2]
#!/usr/bin/env bash
/usr/sbin/sshuttle -r [email protected] 31.13.64.51/32 31.13.65.49/32 31.13.66.49/32 31.13.67.51/32 31.13.68.52/32 31.13.69.240/32 31.13.70.49/32 31.13.71.49/32 31.13.72.52/32 31.13.73.49/32 31.13.74.49/32 31.13.75.52/32 31.13.76.81/32 31.13.77.49/32 31.13.78.53/32 31.13.80.53/32 31.13.81.53/32 31.13.82.51/32 31.13.83.51/32 31.13.84.51/32 31.13.85.51/32 31.13.86.51/32 31.13.87.51/32 31.13.88.49/32 31.13.90.51/32 31.13.91.51/32 31.13.92.52/32 31.13.93.51/32 31.13.94.52/32 31.13.95.63/32 50.22.198.204/30 50.22.210.32/30 50.22.210.128/27 50.22.225.64/27 50.22.235.248/30 50.22.240.160/27 50.23.90.128/27 50.97.57.128/27 75.126.39.32/27 108.168.171.224/27 108.168.174.0/27 108.168.176.192/26 108.168.177.0/27 108.168.180.96/27 108.168.254.65/32 108.168.255.224/32 108.168.255.227/32 157.240.0.53/32 157.240.1.53/32 157.240.2.53/32 157.240.3.53/32 157.240.6.53/32 157.240.7.54/32 157.240.8.53/32 157.240.9.53/32 157.240.10.53/32 157.240.11.53/32 157.240.12.53/32 158.85.0.96/27 158.85.5.192/27 158.85.46.
@sayz
sayz / db_backup.sh
Last active October 15, 2017 12:42
#!/usr/bin/env bash
set -o errexit
exec &>> /var/log/maria_db_backup.log
# Options
BACKUP_PATH="/opt/db_backups"
DATE=$(/bin/date +"%d-%b-%Y")
logger ()
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
{% for id, settings in monitor.items()|sort -%}
/opt/splunkforwarder/bin/splunk add monitor {{ settings['monitor'] }} -index {{ settings['index'] }} -auth admin:changeme
{% endfor %}
##TODO
# admin:changeme pillar'ın içine taşınacak
# admin:changeme pillar'dan cmd.script'e geçirilecek
@sayz
sayz / ldap.filter
Created November 23, 2016 10:16
ldap gruplarını splunk'a çekerken kullanılacak filtre
(!
(|
(cn=svn*)
(cn=fisheye*)
(cn=m_*)
(cn=nexus-admin*)
(cn=tempo-admins*)
(cn=systemro*)
(cn=a_*)
)