Skip to content

Instantly share code, notes, and snippets.

Ellery Leung alucard001

Block or report user

Report or block alucard001

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alucard001
alucard001 / GoogleIndexing.py
Created May 27, 2019
Google Indexing API V3 Working example with Python 3
View GoogleIndexing.py
from oauth2client.service_account import ServiceAccountCredentials
import httplib2
import json
import pandas as pd
# https://developers.google.com/search/apis/indexing-api/v3/prereqs#header_2
JSON_KEY_FILE = "json_key_file_downloaded_after_creating_your_google_service_account_see_above_details_on_how_to_do.json"
SCOPES = ["https://www.googleapis.com/auth/indexing"]
@alucard001
alucard001 / googlesearch.py
Last active Jun 24, 2019
Google Search API Working Example - Python 3 + MSSQL
View googlesearch.py
#!/usr/local/bin/python3
'''
This program is used to get all search terms in Google search console and save it in MSSQL DB.
Please note: Just using this .py is not enough. You need to create a Google service account in google API console and
connect that service account to Google search console property.
Points to note:
===============
@alucard001
alucard001 / apns.py
Created Jun 2, 2017
Python Apple Push Notification HTTP/2 Example - Silent Push
View apns.py
"""
Use HTTP/2 send APNS Example main reference
===========================================
http://gobiko.com/blog/token-based-authentication-http2-example-apns/
Error 410 to detect uninstalls
==============================
https://leftshift.io/mobile-tracking-uninstalls-on-ios-and-android
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
@alucard001
alucard001 / check_email_server_alive.py
Last active May 17, 2017
Python 2 Linux send email through Gmail using SMTP
View check_email_server_alive.py
# Python 2 Script. It works as of 17 May 2017
import os
if "CONNECTED" not in os.popen("/usr/bin/openssl s_client -connect 192.168.1.15:25 | /bin/grep '^CONNECTED'").read():
# Note about sending email using Gmail SMTP
# https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server
# http://stackoverflow.com/questions/20337040/gmail-smtp-debug-error-please-log-in-via-your-web-browser
# How to send email using Linux Command: http://www.binarytides.com/linux-mailx-command/
@alucard001
alucard001 / woocommerce-product-category.php
Created Apr 30, 2017
WooCommerce Product Category List
View woocommerce-product-category.php
<?php
/**
* @package Woocommerce Product Category List
* @version 1.0
*/
/*
Plugin Name: Woocommerce Product Category List table
Plugin URI: https://www.linkedin.com/in/elleryleung
Description: This plugin is just add a new shortcode: <code>[bp_product_category]</code> to list all product categories in div format.
Author: Ellery Leung
@alucard001
alucard001 / numerai.py
Last active Jan 17, 2018
Using TPOT Classifier to analysis Numerai dataset
View numerai.py
"""
Largely come from TPOT example. The only control you can do to prevent timeout
and successful running is the "generation" and "population_size" parameters.
Remember, scoring is "log_loss" as of 18 Jan 2017, not probability
The larger the generation and population_size, the longer time you take to get result.
"""
from tpot import TPOTClassifier
from sklearn.model_selection import train_test_split
@alucard001
alucard001 / clean_email.py
Last active Jan 18, 2017
Python Validate Email example script
View clean_email.py
# coding: utf-8
import pandas as pd
import numpy as np
from validate_email import validate_email
import sys
# Note: you may encounter error if you don't have pyDNS or pyDNS3 installed.
import DNS
DNS.defaults["server"] = ["8.8.8.8", "8.8.4.4"]
@alucard001
alucard001 / csv_for_excel.php
Created Jan 18, 2017
PHP CSV for Excel file download
View csv_for_excel.php
<?php
// Prepare file download
// Special Thanks: https://www.skoumal.net/en/making-utf-8-csv-excel/
$filename = 'some_file_name.csv';
//headers
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
You can’t perform that action at this time.