Skip to content

Instantly share code, notes, and snippets.

@egemenyildiz
egemenyildiz / snm
Created September 8, 2018 17:26
simple network monitoring
tcpdump -i en0 -A | grep -E 'Host:' --line-buffered | sed 's/Host: //g'
@egemenyildiz
egemenyildiz / eksi.bash
Last active October 25, 2017 12:10
eksi topics
#!/bin/bash
curl -sL www.eksisozluk.com | grep -A1000 "topic-list" | grep -B1000 -m1 "</ul>" | grep -e "href" | sed 's/\(href.*popular.>\)//g' | sed 's/\(<\/a>\)//g' | sed -e 's/<[^>]*>//g' | sed 's/^ *//' | awk '{ print $NF,$0 }' | sort -k1,1 -nr | cut -f2- -d' '
class DatabaseWrapper(BaseDatabaseWrapper):
SEARCH_PAGE_SIZE=999
def __init__(self, *args, **kwargs):
super(DatabaseWrapper, self).__init__(*args, **kwargs)
self.charset = "utf-8"
self.creation = DatabaseCreation(self)
self.features = DatabaseFeatures(self)
if django.VERSION > (1, 4):
self.ops = DatabaseOperations(self)
@egemenyildiz
egemenyildiz / spoofmac.sh
Created January 26, 2017 15:02
bash function to spoof hw/MAC address of active/current interface
spomac() {
IFACE=$(ip route get 8.8.8.8 | awk '{print $5}' | head -1)
MAC=$(printf '%02x' $((0x$(od /dev/urandom -N1 -t x1 -An | cut -c 2-) & 0xFE | 0x02)); od /dev/urandom -N5 -t x1 -An | sed 's/ /:/g')
ifconfig $IFACE down;
ifconfig $IFACE hw ether $MAC;
ifconfig $IFACE up;
}
@egemenyildiz
egemenyildiz / fetchall.py
Last active October 31, 2018 08:35
python script to fetch/update all project files from git under a directory
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import argparse
import subprocess
def update_projects(directory):
files = os.listdir(directory)
for f in files:
new_path = os.path.join(directory, f)
@egemenyildiz
egemenyildiz / clonebb.py
Last active June 29, 2016 07:07
clone back-up all projects from a bitbucket team/account
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import argparse
import getpass
import subprocess
import base64
import urllib2
"""
@egemenyildiz
egemenyildiz / remove_pyc.sh
Created July 6, 2015 14:54
remove compiled python files
find . -name "*.pyc" -exec rm -rf {} \;
@egemenyildiz
egemenyildiz / redis_bulk.sh
Created July 1, 2015 13:33
[LUA] Redis bulk/batch operation scripts (rename, delete)
# Bulk deletes keys start with "prefix"
EVAL "for i, name in ipairs(redis.call('KEYS', 'prefix*')) do redis.call('DEL', name); end" 0
# Bulk renames keys start with "prefix" to "postfix".
# e.g. prefixwithtail -> postfixwithtail
EVAL "for i, name in ipairs(redis.call('KEYS', 'prefix*')) do local x = string.gsub(name, 'pre', 'post'); redis.call('RENAME', name, x); end" 0

Keybase proof

I hereby claim:

  • I am egemenyildiz on github.
  • I am ege (https://keybase.io/ege) on keybase.
  • I have a public key whose fingerprint is 55DB C68D 67B2 6A5C F5AE 7F40 0F11 0F71 14E4 8BDA

To claim this, I am signing this object: