Skip to content

Instantly share code, notes, and snippets.

View pengelana's full-sized avatar
🍿

Tiarap pengelana

🍿
  • Tiarap Inc.
View GitHub Profile
$ python3 -m timeit -n 1000000 -r 5 -v 'dict()'
raw times: 1.25 1.2 1.2 1.2 1.2
1000000 loops, best of 5: 1.2 usec per loop
$ python3 -m timeit -n 1000000 -r 5 -v '{}'
raw times: 0.375 0.368 0.375 0.375 0.372
1000000 loops, best of 5: 0.368 usec per loop
@pengelana
pengelana / dicttest.py
Last active May 30, 2021 07:19
dict 2
In [132]: def test1():
...: with open('domain.txt') as f:
...: data = {}
...: for x in f:
...: length = len(x.strip().split('.'))
...: data[length] = 1 if not length in data else data[length] + 1
...: return data
...:
In [133]: def test():
@pengelana
pengelana / block_amazon.sh
Created January 26, 2020 09:58
block_amazon
curl -si 'https://ip-ranges.amazonaws.com/ip-ranges.json' | grep 'ip_prefix' | awk '{print $NF}' | sed 's/[",]//g' | xargs -n1 /sbin/ipset add blacklist
curl -si 'https://ip-ranges.amazonaws.com/ip-ranges.json' | grep 'ipv6_prefix' | awk '{print $NF}' | sed 's/[",]//g' | xargs -n1 /sbin/ipset add blacklist
b = 'yv4BAAABAAAAAAABAAACAAEAACkQAAAAAAAAFAAMABB9QMeJo7kUaHV_uiVmzgYb'
DNSRecord.parse(binascii.unhexlify(base64.urlsafe_b64decode('{}{}'.format(b, '=' * (len(b)%4))).encode('hex')))
from dns import message
from base64 import urlsafe_b64decode
print(message.from_wire(urlsafe_b64decode(b.encode())))
import requests
try:
from hyper.contrib import HTTP20Adapater as HTTPAdapater
except ImportError:
from requests.adapters import HTTPAdapter
session = requests.Session()
session.mount('https://', HTTP20Adapter(max_retries=3))
r = session.get('https://www.instagram.com/')
@pengelana
pengelana / cacheall.js
Last active July 22, 2024 00:46
cacheall
/* cacheall */
async function handleRequest(event) {
let request = event.request
let cacheKey = request
let url = new URL(request.url)
if (request.method.toUpperCase() === 'POST') {
let string = '';
(new Uint8Array(await request.arrayBuffer())).forEach(
# https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml
# Type 129 - Echo Reply
tcpdump -ni eth0 'ip6[40:2] == 0x8000'
# Type 128 - Echo Request
tcpdump -ni eth0 'ip6[40:2] == 0x8100'
# Type 135 - Neighbor Solicitation
tcpdump -ni eth0 'ip6[40:2] == 0x8700'
### Keybase proof
I hereby claim:
* I am pengelana on github.
* I am tiarap (https://keybase.io/tiarap) on keybase.
* I have a public key ASAnYmoLaAs-PV3xnkd-RskcwJ1Tkhbxj3vABqHUEg6qMAo
To claim this, I am signing this object: