Skip to content

Instantly share code, notes, and snippets.

View derekphilipau's full-sized avatar
🔥
makin' pots

Derek Philip Au derekphilipau

🔥
makin' pots
View GitHub Profile
@derekphilipau
derekphilipau / delete_cloudflare_images.py
Created January 4, 2024 03:39
Delete all Cloudflare images
# Delete all Cloudflare images
# Useful if migrating to a different images provider
# Unfortunately Cloudflare still doesn't offer bulk delete
import requests
# Replace with your actual account and authorization details
account_identifier = "youraccountid"
api_token = "yourapitokenhere"
@derekphilipau
derekphilipau / generate_tf_records.py
Created April 8, 2021 04:08
Generate tf records from the data
'''
Reference repo: https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/blob/master/generate_tfrecord.py
It's necessary to install the tensorflow object detection first
'''
import tensorflow as tf
import pandas as pd
import argparse
import logging
import io
@derekphilipau
derekphilipau / imagecolorizercolab.ipynb
Created February 25, 2021 09:12
Dau-ImageColorizerColab.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@derekphilipau
derekphilipau / dhashname.py
Created April 17, 2020 03:16
small hack to rename a file based on its dhash hex value
import dhash
from PIL import Image
import shutil
import os
path1 = "images/"
path2 = "out/"
listing = os.listdir(path1)
for file in listing:
@derekphilipau
derekphilipau / renamewiptc.py
Created April 17, 2020 03:15
just a small hack to rename a file based on its iptc caption
from PIL import Image, IptcImagePlugin
import os
from urllib.parse import urlparse
path1 = "./out/"
listing = os.listdir(path1)
for file in listing:
im = Image.open(path1 + file)
iptc = IptcImagePlugin.getiptcinfo(im)
@derekphilipau
derekphilipau / StyleGAN-StyleGAN2-Google-Cloud-Compute.md
Last active April 19, 2022 09:03
StyleGAN & StyleGAN2 on Google Cloud Compute

Modifying Laravel's default JSON API Resources meta section

When implementing a JSON API, you may be required to modify Laravel's standard JSON API Resource meta section, in particular pagination.

Laravel's default JSON pagination looks like this:

"links":{
    "first": "http://example.com/pagination?page=1",
    "last": "http://example.com/pagination?page=1",
    "prev": null,
@derekphilipau
derekphilipau / Date-Select-Markup.html
Last active March 12, 2019 19:00 — forked from aleksblago/Date-Select-Markup.html
Markup: Select options for Month, Day, and Year.
<span>
<select name="month">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
@derekphilipau
derekphilipau / tax_software.md
Last active July 17, 2018 18:29
Tax Handling of Various Software
@derekphilipau
derekphilipau / gist:455ea1b842a72aee42d9c765d4418d3a
Created September 18, 2017 08:35
laravel package dev using repository
1. Download or clone the https://github.com/derekphilipau/LogViewer
2. Create a new laravel installation. Generate application key.
3. In composer.json, add a filesystem repository:
```
"repositories": [
{
"type": "path",