Skip to content

Instantly share code, notes, and snippets.

@danielgross
danielgross / quickadd.py
Last active December 18, 2024 10:17
Quick Add to Google Calendar
"""
Use GPT-3 to generate a calendar event based on natural language input.
I tried having GPT-3 generate the URL directly, but, amusingly, that didn't work well.
"""
import os
import sys
import openai
import datetime
import pytz
@iiLaurens
iiLaurens / code.js
Last active January 12, 2025 13:21
Get all clickable elements on a page
window.scrollTo(0, 0)
var bodyRect = document.body.getBoundingClientRect();
var items = Array.prototype.slice.call(
document.querySelectorAll('*')
).map(function(element) {
var rect=element.getBoundingClientRect();
return {
element: element,
include: (element.tagName === "BUTTON" || element.tagName === "A" || (element.onclick != null) || window.getComputedStyle(element).cursor == "pointer"),
@Treeki
Treeki / TurnipPrices.cpp
Last active February 3, 2025 16:27
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@Snarp
Snarp / google-docs-copy.js
Last active February 20, 2025 02:34
Script to allow copying from a protected Google Doc
/*
<https://stackoverflow.com/questions/40296831/is-it-possible-to-force-a-copy-of-a-protected-google-doc>
NOTE - 2021-05-24
-----------------
The script below isn't the fastest way to copy-and-paste from a protected
Google Doc. Before trying it, I'd suggest following MikoFrosty's advice from
the comments:
@jrc03c
jrc03c / download-canvas-as-image.js
Created February 13, 2020 15:10
Download the contents of an HTML5 canvas as an image
function downloadCanvasAsImage(canvas, filename){
let a = document.createElement("a")
a.href = canvas.toDataURL()
a.download = filename
a.dispatchEvent(new MouseEvent("click"))
}
@jcsteh
jcsteh / SpotifyGlobalKeys.ahk
Last active January 21, 2025 22:34
AutoHotkey script to control Spotify with global keyboard shortcuts
; SpotifyGlobalKeys.ahk:
; AutoHotkey script to control Spotify with global keyboard shortcuts
; Author: James Teh <[email protected]>
; Copyright 2017-2018 James Teh
; License: GNU General Public License version 2.0
DetectHiddenWindows, On
; Get the HWND of the Spotify main window.
getSpotifyHwnd() {
@kehanlu
kehanlu / index.html
Last active January 7, 2025 09:45
get tickets with google flights (python webcrawler)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>找機票</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<!-- JQuery -->
<script src="http://apps.bdimg.com/libs/jquery/1.11.1/jquery.min.js"></script>
<style>
.search{
@Vazkii
Vazkii / index.php
Last active September 23, 2020 02:24
LLSIF Favorite UR Picker https://vazkii.us/favorite-ur/
<?php
define('CACHE_DIR', './cache');
define('FONT', './lido_stf_ce.ttf'); // you need to get this one yourself
define('OUR_URL', 'https://vazkii.us/favorite-ur');
if(!file_exists(CACHE_DIR))
mkdir(CACHE_DIR);
$idol_names =
[ 'Kousaka Honoka', 'Ayase Eli', 'Minami Kotori', 'Sonoda Umi', 'Hoshizora Rin', 'Nishikino Maki', 'Toujou Nozomi', 'Koizumi Hanayo', 'Yazawa Nico',
@jasperf
jasperf / wget
Created June 29, 2016 01:55 — forked from bueckl/wget
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@evansims
evansims / example.html
Last active December 13, 2024 20:18
Embedding or sharing a image or photo uploaded to Google Drive.
<a href="https://drive.google.com/uc?export=view&id=XXX"><img src="https://drive.google.com/uc?export=view&id=XXX" style="width: 500px; max-width: 100%; height: auto" title="Click for the larger version." /></a>