Skip to content

Instantly share code, notes, and snippets.

View mertsalik's full-sized avatar
🏡
WFH only.

Mert Salık mertsalik

🏡
WFH only.
View GitHub Profile
# TOPICS
kafka-topics --bootstrap-server localhost:9092 --list
kafka-topics --bootstrap-server localhost:9092 --topic topic_name --create --partitions 3 --replication-factor 2
kafka-topics --bootstrap-server localhost:9092 --topic topic_name --describe
kafka-topics --bootstrap-server localhost:9092 --topic topic_name --delete
@mertsalik
mertsalik / batch_crop.py
Created January 2, 2021 22:57
Batch crop multiple images of the same size #batchcrop #imagecrop
# -*- coding: utf-8 -*-
__author__ = "mertsalik"
__copyright__ = "Copyright 2021"
__credits__ = ["mertsalik", ""]
__license__ = "Private"
__email__ = ""
import os
import pathlib
import objc
objc.loadBundle('CoreWLAN', bundle_path = '/System/Library/Frameworks/CoreWLAN.framework',
module_globals = globals())
iface = CWInterface.interface()
# Scan all available networks
iface.scanForNetworksWithName_includeHidden_error_(None, True, None)
# Scan with specific name
networks, error = iface.scanForNetworksWithName_error_('FooNetworkName', None)
@mertsalik
mertsalik / Abuzer.py
Last active February 28, 2019 14:09
abuse endpoints
import requests
class Abuzer(object):
def __init__(self, base_url, login_path):
self.base_url = base_url
self._login_path = login_path
self._session = requests.session()
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
from weasyprint import HTML
from io import BytesIO
def convert_html_to_pdf(html_string):
"""
:param html_string: rendered invoice html
:return: bytes array
"""
with BytesIO() as byte_io:
HTML(string=html_string).write_pdf(byte_io)
@mertsalik
mertsalik / md
Last active February 6, 2018 11:22
Interactive Python in Shell
See: https://stackoverflow.com/a/246779/930899
I may have found a way to do it.
Create a file .pythonrc
# ~/.pythonrc
# enable syntax completion
try:
import readline
# Ubuntu 16.04.2 LTS
# rcn-ee.net console Ubuntu Image 2017-07-14
# Beagle bone black
mkdir tmp
cd tmp
git clone https://github.com/lwfinger/rtl8188eu.git
cd rtl8188eu
make all
sudo make install
# US East speedtest.newark.linode.com 100MB-newark.bin
# US South speedtest.atlanta.linode.com 100MB-atlanta.bin
# US Central speedtest.dallas.linode.com 100MB-dallas.bin
# US West speedtest.fremont.linode.com 100MB-fremont.bin
# Frankfurt speedtest.frankfurt.linode.com 100MB-frankfurt.bin
# London speedtest.london.linode.com 100MB-london.bin
# Singapore speedtest.singapore.linode.com 100MB-singapore.bin
# Tokyo 2, Japan speedtest.tokyo2.linode.com 100MB-tokyo2.bin
echo "US EAST"
#!/bin/bash
#set -e
# install-wifi - 28/05/2017 - by MrEngman.
UPDATE_SELF=${UPDATE_SELF:-1}
UPDATE_URI="http://www.fars-robotics.net/install-wifi"
ROOT_PATH=${ROOT_PATH:-"/"}
WORK_PATH=${WORK_PATH:-"${ROOT_PATH}/root"}