Skip to content

Instantly share code, notes, and snippets.

View Gowee's full-sized avatar
🙂

Hung-I Wang Gowee

🙂
View GitHub Profile
@Gowee
Gowee / getRawPostData.php
Created November 12, 2015 12:43
alternative for file_get_contents("php://input");
<?php
function getRawPostData(){
$eol = "\r\n";
$BOUNDARY = substr(ltrim(explode(";", $_SERVER["CONTENT_TYPE"])[1]), strlen("boundary="));
$postData = "";
foreach($_POST as $name => $value){
$postData .= "--" . $BOUNDARY . $eol;
$postData .= 'Content-Disposition: form-data; name="' . $name . '"' . $eol . $eol;
$postData .= $value . $eol;
}
@Gowee
Gowee / chaoxing.py
Last active December 20, 2022 03:16
#!/usr/bin/dev python3
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import urllib.parse
import json
from PIL import Image
import pytesseract
import time
#!/usr/bin/dev python3
# -*- coding: utf-8 -*-
import requests
import json
from ics import Calendar, Event
import arrow
from uuid import uuid4
# Below are your credentials for log-in.
#!/usr/bin/env python3
import urllib.request
import re
from collections import namedtuple
from math import log
def ip2num(ip_address: str) -> int:
a, b, c, d = map(int, ip_address.split("."))
return (a << 24) + (b << 16) + (c << 8) + d
@Gowee
Gowee / pptpclient@.service
Last active December 3, 2016 05:07
systemd service script for pptpclient
# Modified from OpenVPN systemd service script.
[Unit]
Description=PPTP Client connection to %I
After=syslog.target network.target network-online.target
[Service]
PrivateTmp=true
Type=forking
ExecStart=/usr/bin/pon %i persist
PIDFile=/run/ppp0.pid
@Gowee
Gowee / get-cert-issuer.sh
Created November 7, 2016 14:24
One-line Bash script to fetch the issuer CA certificate of an x509-specified certificate via id-ad-caIssuers of x509.v3 Authority Information Access extension.
#!/bin/bash
# Maintainer: Gowe Wang<i@gowe.wang>
# Reference: https://tools.ietf.org/html/rfc5280#section-4.2.2.1
# Notice: Just available in most cases.
curl -s $(openssl x509 -in $1 -noout -text | grep -Po "((?<=CA Issuers - URI:)http://.*)$") | openssl x509 -inform DER -outform PEM
@Gowee
Gowee / README.md
Created June 24, 2018 16:24
Rotate the avatar of Telegram based on the time in a day using Pyrogram(MTProto).
@Gowee
Gowee / README.md
Last active September 20, 2018 02:43
To help detect being added into unknown groups on Telegram.

A script to help detect being added to new groups on Telegram. When detected, logs are sent to Saved Message with a corresponding tag to facilitate locating.

Usage:

Setup Pyrogram (MTProto) at first: https://docs.pyrogram.ml/start/ProjectSetup.

chmod +x baugd.py
./baugd.py
@Gowee
Gowee / telegram_reborn.py
Created December 24, 2018 07:14
"Reborn" in groups on Telegram (
#!/usr/bin/env python3
import sys
import json
from functools import partial
from pyrogram import Client, Error
from pyrogram.client.types.user_and_chats.dialog import Dialog
from pyrogram.client.types.user_and_chats.chat import Chat
from pyrogram.api.functions.channels import InviteToChannel
eprint = partial(print, file=sys.stderr)
@Gowee
Gowee / relayd.patch
Created January 19, 2019 03:59
openwrt /etc/init.d/relayd
3a4,5
> . $IPKG_INSTROOT/lib/functions/network.sh
>
45a48
> local dhcp_ipaddr
47a51,64
> config_get proto "$net" proto
> [ "$proto" = "dhcp" ] && {
> local addrs
> network_get_ipaddr addrs "$net"