Skip to content

Instantly share code, notes, and snippets.

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

Mustafa Kırımlı mustafakirimli

🏠
Working from home
View GitHub Profile
@mustafakirimli
mustafakirimli / enable_vmx.sh
Last active December 15, 2022 20:02
Enable nested virtualization on GKE (be careful when running)
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
# $IG_URLS as env
# GET auth token to be used in curl/rest api
AUTH_TOKEN=$(gcloud auth print-access-token)
@mustafakirimli
mustafakirimli / socket_server.py
Created September 8, 2021 11:37
basic socket server in Python
import socket
import sys
import datetime
def socket_server():
bind_ip = '0.0.0.0'
bind_port = 8000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen()
#!/bin/python
import sys
import time
import socket
HOST = '127.0.0.1'
PORT = 2001
while True:
try:
print(f"trying to connect {HOST}:{PORT}")
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
#!/bin/bash
declare -a CF_ACCESS_HOSTS=(
"https://gitlab.mywebsite.com"
"https://gitlab.mycompany.com"
)
is_cf_git_host() {
host_name=$(echo "$1" | awk -F/ '{print $3}')
printf '%s\n' "${CF_ACCESS_HOSTS[@]}" | grep --quiet "$host_name";
@mustafakirimli
mustafakirimli / k8s-shortcuts.sh
Created March 3, 2019 16:51
Some small shortcuts on Kubernetes for daily tasks. Be careful and test before using on production
function kpod {
# $1 pod name
# $2 namespace
# $3 extra args for command
podName=$1
envName=$2
eArgs=$3
kubectl get pod -n $envName -o yaml $podName $eArgs
}
@mustafakirimli
mustafakirimli / recursive-zip-file-creation.sh
Created January 13, 2019 11:13
Create recursive zip file to test email security solutions whether blocking recursively zipped files
#!/bin/bash
REC_COUNT=40
echo "This script gonna create a zip file and make it ${REC_COUNT} times zipped resursively"
sleep 2
echo "test content" > test0.txt
zip -r test0.zip test0.txt
@mustafakirimli
mustafakirimli / migrate-redis.py
Last active February 18, 2018 13:56 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
var CoinStats = (function () {
var coin_data;
var debug_mode = false;
function clog(message){
if( debug_mode == true ){
console.log(message);
}
}
def replace_dict(obj, cbv, key=lambda x: True, value=lambda x: True):
"""
Replaces dict values recursively.
>>> cats = {
"name": "Telefon",
"desc": "Telefon modelleri",
"id": 1,
"is_active": "True",
############ kurulum icin basit ayarlar, istedigimiz sekilde degistirebiliriz ###########
export SOLR_DIR='solr4' # tum uygulama, konfigurasyon ve datalarin olacagi klasor
export SOLR_PORT='8082' # solr'i kullanmak istedigimiz port
export TOMCAT_MPORT='8006' # tomcat yonetim portu
export SOLR_VER='4.7.0' # kullanmak istedigimiz solr versionu
export TOMCAT_VER='8.0.3' # kullanmak istedigimiz tomcat versionu
export ZOO_VER='3.4.5' # zookeeper version
export SOLR_HOME='solr_home' # solr'a ait data ve konfigurasyonlarin bulunacagi klasor
if [ -d "/Applications/" ]
then