Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂

Hung-I Wang Gowee

🙂
View GitHub Profile
@Gowee
Gowee / README.md
Created Jun 24, 2018
Rotate the avatar of Telegram based on the time in a day using Pyrogram(MTProto).
View README.md
@Gowee
Gowee / get-cert-issuer.sh
Created Nov 7, 2016
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.
View get-cert-issuer.sh
#!/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 / pptpclient@.service
Last active Dec 3, 2016
systemd service script for pptpclient
View pptpclient@.service
# 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
View CNRoutesGen.py
#!/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
View Timetable2iCal_SWU.py
#!/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.
View chaoxing.py
#!/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
@Gowee
Gowee / getRawPostData.php
Created Nov 12, 2015
alternative for file_get_contents("php://input");
View getRawPostData.php
<?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;
}