Skip to content

Instantly share code, notes, and snippets.

View avinash's full-sized avatar

Avinash Meetoo avinash

View GitHub Profile
@avinash
avinash / gist:be8feb3dca6847a75ab3fa4f03f6f0f3
Created March 16, 2023 07:36
Export WordPress posts in a more digestible format
-- See https://stackoverflow.com/a/13265356 and the subsequent comments
SELECT DISTINCT
post_title
, post_content
,(SELECT DISTINCT wpm2.meta_value FROM wp_posts wp INNER JOIN wp_postmeta wpm ON (wp.ID = wpm.post_id AND wpm.meta_key = '_thumbnail_id') INNER JOIN wp_postmeta wpm2 ON (wpm.meta_value = wpm2.post_id AND wpm2.meta_key = '_wp_attached_file') WHERE wp.ID = wp_posts.ID) AS "Featured Image"
,(SELECT group_concat(wp_terms.name separator ', ')
FROM wp_terms
INNER JOIN wp_term_taxonomy on wp_terms.term_id = wp_term_taxonomy.term_id
INNER JOIN wp_term_relationships wpr on wpr.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
@avinash
avinash / gist:72058073a9f6fbf857bb6cebb2615d7b
Created March 12, 2021 07:09
Download exam papers from gceguide.com
# Step 1: Download the HTML file corresponding to a year
wget "https://papers.gceguide.com/A%20Levels/Mathematics%20(9709)/2020/" -O 2020.html
# Step 2: Use sed, tr and awk to clean the HTML file so that we only have the names of the PDF files and download them individually with wget
cat 2020.html | sed 's/<li class=.file.>/£/g' | tr '£' '\n' | grep pdf | sed 's/^.*class=.name.>//g' | sed 's/<.*$//g' | awk '{ print "wget \"https://papers.gceguide.com/A%20Levels/Mathematics%20(9709)/2020/" $0 "\"" }' | bash
@avinash
avinash / LICENSE
Last active July 14, 2023 06:19
random-locality
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
#!/usr/bin/env python
import datetime
base = datetime.datetime(year=2019, month=5, day=11, hour=3, minute=0, second=0)
delta = datetime.timedelta(hours=3)
start = 1
end = 76
@avinash
avinash / generate_complementary.py
Created March 10, 2020 04:29
Generate a complementary colour using the HSLuv colour space
# Generate colours which work well together
# Reference
# https://www.kuon.ch/post/2020-03-08-hsluv/
# https://www.boronine.com/2012/03/26/Color-Spaces-for-Human-Beings/
# https://github.com/hsluv/hsluv-python
import hsluv
# Some simple constants
@avinash
avinash / Azor_Intents.json
Created April 11, 2019 14:03
Azor_Intents.json
{
"intents":[
{
"tag":"technology",
"patterns":[
"What technology do you use?",
"Are you magical?"
],
"responses":[
"I use TFLearn and TensorFlow",
@avinash
avinash / Azor_Intents.json
Created April 11, 2019 14:03
Azor_Intents.json
{
"intents":[
{
"tag":"technology",
"patterns":[
"What technology do you use?",
"Are you magical?"
],
"responses":[
"I use TFLearn and TensorFlow",
@avinash
avinash / kindle-spit-by-book.php
Created May 23, 2017 05:19
kindle "My Clippings.txt" splitter
#!/usr/bin/php
<?php
if (empty($argv[2])) {
throw new Exception('usage: <this file> "/path/to/My Clippings.txt" /path/to/ouputfiles');
}
$myClippingsFile = $argv[1];
$splitDir = $argv[2];

Keybase proof

I hereby claim:

  • I am avinash on github.
  • I am avinashmeetoo (https://keybase.io/avinashmeetoo) on keybase.
  • I have a public key whose fingerprint is DFDB 7B40 FE8C 3360 19FF 2279 26ED 6B3B 0E55 0028

To claim this, I am signing this object: