Skip to content

Instantly share code, notes, and snippets.

[
{
"il": "Adana",
"plaka": 1,
"ilceleri": [
"Aladağ",
"Ceyhan",
"Çukurova",
"Feke",
"İmamoğlu",
@sh4dowb
sh4dowb / gist:918d93323ad6cef57d6c2a0b11ef65f4
Created May 7, 2019 16:17
minimal linux laptop iptables settings
# Generated by iptables-save v1.6.1 on Tue May 7 19:15:45 2019
*filter
:INPUT DROP [349:29624]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [573:36440]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 445 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
@sh4dowb
sh4dowb / ilce-listesi.json
Last active February 24, 2020 18:31
UETDS Eşya Taşımacılığı Ülke ve İlçe Listesi JSON
[
{"kod":99133,"il_kodu":"1","ad":"Şakirpaşa Havalimanı","il_adi":"ADANA"},
{"kod":2033,"il_kodu":"1","ad":"ÇUKUROVA","il_adi":"ADANA"},
{"kod":2032,"il_kodu":"1","ad":"SARIÇAM","il_adi":"ADANA"},
{"kod":1806,"il_kodu":"1","ad":"İMAMOĞLU","il_adi":"ADANA"},
{"kod":1757,"il_kodu":"1","ad":"ALADAĞ","il_adi":"ADANA"},
{"kod":1748,"il_kodu":"1","ad":"YÜREĞİR","il_adi":"ADANA"},
{"kod":1734,"il_kodu":"1","ad":"YUMURTALIK","il_adi":"ADANA"},
{"kod":1687,"il_kodu":"1","ad":"TUFANBEYLİ","il_adi":"ADANA"},
{"kod":1588,"il_kodu":"1","ad":"SAİMBEYLİ","il_adi":"ADANA"},
@sh4dowb
sh4dowb / multipleevent.py
Last active June 18, 2020 07:21
telethon capture multiple events - capture button and/or text event
def press_or_text(user_id):
return events.Raw(func=lambda e: (type(e) == UpdateNewMessage and e.message.from_id == user_id) or (type(e) == UpdateBotCallbackQuery and e.user_id == user_id and e.data != b'cancel'))
whatever = await conv.wait_event(press_or_text(sender))
if type(whatever) == UpdateBotCallbackQuery and whatever.data in [b'create', b'list']:
# button clicked
# not actual event like "CallbackQuery", you can't use .edit() etc. directly
print(whatever.data)
else:
# message sent
@sh4dowb
sh4dowb / netherlands-iban-acc-number-validate.py
Last active December 25, 2020 18:44
Netherlands IBAN account number checksum validator
# Netherlands account number algorithm uses this factor table:
# digit | factor
# 1st | 10
# 2nd | 9
# ...
# 10th | 1
#
# After multiplying digits according to the table, sum of these results must be divisible with 11
@sh4dowb
sh4dowb / decrypt_ruby_MessageEncryptor.py
Created April 8, 2021 07:34
Decrypt Ruby's ActiveSupport::MessageEncryptor on Python 3
import hashlib
import base64
from Crypto import Random
from Crypto.Cipher import AES
import rubymarshal.reader
from pbkdf2 import PBKDF2
SECRET = "a3f58debfe0c5b71edaebea3a627f4f"
SALT = "12345"
ITERATIONS = 65536
@sh4dowb
sh4dowb / decrypt_ruby_MessageEncryptor.py
Last active April 17, 2021 18:14
Decrypt Ruby's ActiveSupport::MessageEncryptor on Python 3
import hashlib
import base64
from Crypto import Random
from Crypto.Cipher import AES
import rubymarshal.reader
from pbkdf2 import PBKDF2
SECRET = "asdasd"
ITERATIONS = 65536
KEYLENGTH = 32
@sh4dowb
sh4dowb / atomic_eth.js
Created May 30, 2021 20:03
atomic wallet get eth private key / address by mnemonic seed
// fuck you atomic. why can't you just be fucking normal?
// east home innocent snake icon curtain series brave guard program history stand
// BIP39 seed:
var seed = new Uint8Array([70, 78, 5, 155, 232, 171, 38, 78, 191, 56, 142, 102, 122, 20, 65, 239, 127, 215, 39, 174, 28, 222, 17, 150, 102, 129, 182, 172, 246, 80, 15, 19, 79, 248, 113, 244, 95, 101, 33, 96, 203, 181, 243, 63, 23, 9, 71, 102, 37, 216, 196, 6, 77, 209, 18, 2, 107, 12, 239, 38, 249, 29, 107, 249]);
var s = require('ethereum-cryptography/pure/hdkey').HDKey;
var t = require('ethereumjs-wallet');
var w = s.fromMasterSeed(seed);
@sh4dowb
sh4dowb / README
Last active August 22, 2021 21:49
satellite_track.py and site source code for https://cagriari.com/satellite/
needs;
rtl_fm
sox
wxtoimg (https://wxtoimgrestored.xyz/beta/wxtoimg-armhf-2.11.2-beta.deb)
wxmap on your server for map generation (https://wxtoimgrestored.xyz/beta/wxtoimg-amd64-2.11.2-beta.deb)
(because wxmap on ARM is not working, at least for me)
python3
requests
noaa-apt
n2yo account and api key
@sh4dowb
sh4dowb / gist:861934f2d0472400c6f9a764b4b7589d
Last active December 9, 2021 09:02
telethon get if participant is admin
from telethon.tl.types import ChannelParticipantCreator, ChannelParticipantAdmin
from telethon.tl.functions.channels import GetParticipantRequest
#..
@client.on(events.NewMessage)
async def handler(event):
participant = await client(GetParticipantRequest(channel=event.original_update.message.to_id.channel_id,user_id=event.original_update.message.from_id))
isadmin = (type(participant.participant) == ChannelParticipantAdmin)
iscreator = (type(participant.participant) == ChannelParticipantCreator)