Skip to content

Instantly share code, notes, and snippets.

View midir99's full-sized avatar
🌚
Hi!

midir99 midir99

🌚
Hi!
View GitHub Profile
@lelandbatey
lelandbatey / assign_struct_field_by_tag_name.go
Last active November 8, 2023 15:20
Golang reflection; assign to struct field by tag name
package main
import (
"fmt"
"reflect"
"strings"
)
// The goal: allow assignment to a go struct field based on the name that field
// is tagged with (specifically it's json-tagged name).
@contolini
contolini / mobile-phone-tracking-website.md
Last active June 1, 2024 00:51
How to create a simple real-time location tracking website a la https://whereis.contolini.com

The steps below require a smartphone running Android. If you're an iPhone user you'll have to find an appropriate iOS app for step #4. Maybe this?

  1. Copy this HTML file to wherever you want your page to live.
  2. Create an account at MapBox and generate an API token on your account page.
  3. Replace my API token with yours in the HTML file.
  4. Install GPS Logger for Android on your phone.
  5. Create an account at ThingSpeak and get an API key. We'll use ThingSpeak to store your GPS coordinates.
  6. Create a new ThingSpeak channel. Enable all eight fields and make the channel public. It should look like this.
  7. R
@mkropat
mkropat / knownpaths.py
Last active July 1, 2024 19:21
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)