Skip to content

Instantly share code, notes, and snippets.

@pollardld
pollardld / headshot_smile.py
Last active June 24, 2024 00:58
Code samples from ChatGPT
import numpy as np
from PIL import Image
import cv2
import dlib
# Load the image
image_path = "/mnt/data/me.jpeg"
image = Image.open(image_path)
# Convert the image to OpenCV format
@pollardld
pollardld / newsfeed.md
Created June 16, 2024 22:38
[object Object]

There are:

  • 100M users/authors
  • 20M papers
  • 2M topics

The typical user has:

  • 1k followers
  • 2k followees
  • 10 topics that they follow
  • 30 papers uploaded
@pollardld
pollardld / VagrantfileOS.md
Last active January 22, 2024 21:49 — forked from ilyar/Vagrantfile.md
Find out current OS inside Vagrantfile

Add this into your Vagrantfile:

module OS
    def OS.windows?
        (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
    end

    def OS.mac?
 (/darwin/ =~ RUBY_PLATFORM) != nil
@pollardld
pollardld / geojson2geopdf.py
Last active August 31, 2023 00:10
Making GeoPDFs
import subprocess
# Convert GeoJSON to GeoTIFF
# ATTRIBUTE_FIELD = ?
subprocess.run([
"gdal_rasterize",
"-a", "ATTRIBUTE_FIELD",
"-ts", "WIDTH", "HEIGHT",
"-l", "LAYER_NAME",
"i.geojson",
@pollardld
pollardld / gist:826649c275452a82fe1c45b7e734ac71
Last active August 30, 2023 23:57
GeoJSON to GeoPDF with Python Subprocess
import subprocess
# Step 2: Convert GeoJSON to GeoTIFF
# ATTRIBUTE_FIELD = ?
subprocess.run([
"gdal_rasterize",
"-a", "ATTRIBUTE_FIELD",
"-ts", "WIDTH", "HEIGHT",
"-l", "LAYER_NAME",
"i.geojson",
@pollardld
pollardld / a.md
Last active August 22, 2023 17:00
<a>

rel

<a rel="value">
<a rel="alternate">Print page, translated, mirror, etc.</a>
<a rel="author">creator credit</a>
<a rel="bookmark">permanent url</a>
@pollardld
pollardld / algorithms.md
Last active June 19, 2023 20:04
Algorithms from speedcoder.net

Check if a number is a perfect square

import math

number = int(input())
square_number = int(math.sqrt(number))

if (number == square_number * square_number):
    print("perfect square: %d * %d = %d"%(square_number,square_number,number))
else:
@pollardld
pollardld / iTerm2 cmds.md
Last active June 2, 2023 00:01
iterm2 shell integration commands

iTerm2 Shell Integration Commands

imgcat filename
  Displays the image inline.
imgls
  Shows a directory listing with image thumbnails.
it2api
 Command-line utility to manipulate iTerm2.
@pollardld
pollardld / Boosting.md
Last active June 12, 2023 00:36
Classification

Stump weights (𝐰̂) and data point weights (𝛼) are two different concepts. Stump weights (𝐰̂) tell you how important each stump is while making predictions with the entire boosted ensemble. Data point weights (𝛼) tell you how important each data point is while training a decision stump.