Skip to content

Instantly share code, notes, and snippets.

View ahgood's full-sized avatar

Guojun ahgood

  • Fullstack Developer
  • Halifax
View GitHub Profile
@ahgood
ahgood / Download_images_and_html.html
Last active April 12, 2024 03:07
Download multiple images with html file by pure JavaScript(jszip.js)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript" src="//stuk.github.io/jszip/dist/jszip.js"></script>
<script type="text/javascript" src="//stuk.github.io/jszip-utils/dist/jszip-utils.js"></script>
@ahgood
ahgood / jwt_decode.php
Created June 20, 2016 06:41
Get payload data from JWT token.
<?php
/**
* JSON Web Token implementation
*
* Minimum implementation used by Realtime auth, based on this spec:
* http://self-issued.info/docs/draft-jones-json-web-token-01.html.
*
* @author Neuman Vong <neuman@twilio.com>
*/
class JWT
@ahgood
ahgood / tsconfig.json
Created January 20, 2023 17:34 — forked from thatisuday/tsconfig.json
A simple TypeScript configuration file to be used with Webpack.
{
"compilerOptions": {
"noImplicitAny": true,
"target": "ES5",
"module": "ES2015"
}
}
@ahgood
ahgood / bing-daily-wallpaper.sh
Last active July 14, 2022 18:45 — forked from SamanSh999/changebg.sh
A shell script to set Bing Background as wallpaper automatically on macOS(2022) (requires wget & jq)
#!/usr/bin/env bash
#
# Credit: https://gist.github.com/SamanSh999/3ee8cad2859a900b7e36e1cff4204005
#
# Instruction(macOS only):
#
# 1. Save this script to your home folder
# 2. Grant permission to script: chmod +x ~/bing-daily-wallpaper.sh
# 3. Install homebrew if you don't have it: https://brew.sh/
# 4. Install jq: brew install jq
@ahgood
ahgood / create_worksheets.php
Created August 11, 2017 03:30
Create multiple worksheet by PhpSpreadsheet
<?php
/*
Install: composer require phpoffice/phpspreadsheet:dev-develop
Github: https://github.com/PHPOffice/PhpSpreadsheet/
Document: https://phpspreadsheet.readthedocs.io/
*/
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
@ahgood
ahgood / Postfix_Procmail.txt
Created July 6, 2017 01:40
Postfix and Procmail to monitor incoming email and trigger PHP script sample
Install Postfix and Procmail:
yum install postfix
yum install procmail
(Optional)Setup mail relay: /etc/postfix/main.cf
relayhost = [Relay server IP]
Setup procmail: /etc/postfix/main.cf
mailbox_command = /usr/bin/procmail
@ahgood
ahgood / detect-available-fonts.js
Created August 17, 2021 13:37 — forked from fijiwebdesign/detect-available-fonts.js
Detect available fonts with JS
/**
* JavaScript code to detect available availability of a
* particular font in a browser using JavaScript and CSS.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/javascript-css-font-detect/
* License: Apache Software License 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.15 (21 Sep 2009)
* Changed comparision font to default from sans-default-default,
@ahgood
ahgood / unknow
Last active October 2, 2020 23:56
Unknow
1 apt update
2 apt upgrade
3 apt install shadowsocks-libev
4 nano /etc/shadowsocks-libev/config.json
{
"server":"SERVER-IP-ADDRESS",
"server_port":1984,
"local_port":1080,
"password":"PASSWORD",
@ahgood
ahgood / gist:4d53f6d9ac1f3c593255fd20b15407e1
Created September 2, 2017 01:33
Setting up proxy(Shadowsocks, socket 5) for Google Backup and Sync(Google Photos Mac App)
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
./configure --prefix=/usr --sysconfdir=/etc
make
sudo make install
sudo make install-config
sudo nano /etc/proxychains.conf
add this code to the end of proxychains.conf: socks5 127.0.0.1 1080
proxychains4 open -a /Applications/Backup\ and\ Sync.app
@ahgood
ahgood / index.js
Created January 13, 2020 15:34
Goolge Actions Simulator Helper
// step 1, edit the code:
document.querySelector('.f8r-title').append('🎩');
setInterval(() => {
const cards = document.querySelectorAll("MD-CARD-CONTENT");
cards.forEach((card) => {
if (card.querySelector("img") === null && card.querySelector("a.say") === null) {
const sayTag = document.createElement("a");
sayTag.className = "say";