Skip to content

Instantly share code, notes, and snippets.

View glowinthedark's full-sized avatar

glowinthedark glowinthedark

  • URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
  • HTTPError: HTTP Error 403: Forbidden
View GitHub Profile
@glowinthedark
glowinthedark / disable.sh
Created September 30, 2019 09:39
Disable bunch of #$!@ in Catalina (It's back!)
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
@glowinthedark
glowinthedark / bopomofo.py
Created January 6, 2020 18:33 — forked from ttempe/bopomofo.py
Convert a pinyin string to bopomofo (Zhuyin)
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Thomas TEMPÉ, <[email protected]>
# Copyright © 2014 Alex Griffin, <[email protected]>
#
# DWTFYW license.
# Do what the fuck you want with this file.
import string
@glowinthedark
glowinthedark / selenium_basics.py
Created March 15, 2020 11:20 — forked from nrrb/selenium_basics.py
Selenium stuffs
from selenium import webdriver
profile = webdriver.FirefoxProfile()
# Set proxy settings to manual
profile.set_preference('network.proxy.type', 1)
# Set proxy to Tor client on localhost
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
# Disable all images from loading, speeds page loading
# http://kb.mozillazine.org/Permissions.default.image
<div id="swipezone">
Swipe me
</div>
// credit: http://www.javascriptkit.com/javatutors/touchevents2.shtml
function swipedetect(el, callback){
var touchsurface = el,
swipedir,
startX,
@glowinthedark
glowinthedark / http_multithreaded.py
Created April 3, 2020 21:35 — forked from gnilchee/http_multithreaded.py
Multi-threaded Python3 HTTP Server
#!/usr/bin/env python3
import sys, os, socket
from socketserver import ThreadingMixIn
from http.server import SimpleHTTPRequestHandler, HTTPServer
HOST = socket.gethostname()
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
pass
@glowinthedark
glowinthedark / install_go_pi.sh
Last active June 25, 2023 13:58 — forked from pcgeek86/install_go_pi.sh
Install Go Lang on Raspberry Pi
cd /tmp
fileName='go1.20.5.linux-armv6l.tar.gz'
wget -c https://go.dev/dl/$fileName && sudo rm -rfv /usr/local/go && sudo tar -C /usr/local -xvf $fileName
grep -q 'GOPATH=' ~/.bashrc || cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
@glowinthedark
glowinthedark / install_go_pi.sh
Last active April 11, 2020 21:35 — forked from pcgeek86/install_go_pi.sh
Install Go Lang on Raspberry Pi
cd $HOME
file='go1.14.2.linux-armv6l.tar.gz'
wget "https://dl.google.com/go/$file"
sudo tar -C /usr/local -xvf "$file"
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
# function to take care of downloading file
def enable_download_headless(browser,download_dir):
browser.command_executor._commands["send_command"] = ("POST", '/session/$sessionId/chromium/send_command')
params = {'cmd':'Page.setDownloadBehavior', 'params': {'behavior': 'allow', 'downloadPath': download_dir}}
browser.execute("send_command", params)
@glowinthedark
glowinthedark / AesCrypt_python3.py
Last active August 2, 2020 11:57 — forked from pfote/AesCrypt.py
AES256 with PKCS5 padding
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Crypto.Cipher import AES
import base64
import re
class AesCbc:
@glowinthedark
glowinthedark / exmp3.py
Created August 2, 2020 16:38 — forked from RavuAlHemio/exmp3.py
find and extract MP3 files from a binary file
#!/usr/bin/env python3
from math import floor
import struct
mp3_bit_rates = {
0b0001: 32000,
0b0010: 40000,
0b0011: 48000,
0b0100: 56000,
0b0101: 64000,