Skip to content

Instantly share code, notes, and snippets.

View veb's full-sized avatar
👋

Mike Mackenzie veb

👋
View GitHub Profile
@huytd
huytd / wordle.md
Last active November 1, 2024 05:07
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@jamesmacfie
jamesmacfie / urghStuff.js
Created June 15, 2018 00:09
Find the most negative comment on Stuff.co.nz articles
const findTheMostNegativeComment = () => {
const voteVals = [];
const votes = document.querySelectorAll('.gig-comment-vote-total');
[].forEach.call(votes, (v) => {
const val = v.innerHTML;
if (val.charAt(0) === '-') {
voteVals.push({
text: val,
total: parseInt(val.slice(1)),
el: v
@jgrahamc
jgrahamc / pwnd.js
Created February 24, 2018 16:36
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)
set theSearchPath to "/Users/<username>"
set theResults to do shell script "find " & quoted form of theSearchPath & " -name .git 2>&1 | grep -v 'Permission denied'"
repeat with i from 1 to (count paragraphs of theResults)
set theResult to paragraph i of theResults
set theParentPath to text 1 through ((length of theResult) - 5) of theResult
set theParentAlias to POSIX file (theParentPath) as alias
tell application "Finder"
set label index of theParentAlias to 6
-- Set the last value of the previous line corresponding to label color desired
@ndarville
ndarville / business-models.md
Last active October 23, 2024 17:18
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@nicoleslaw
nicoleslaw / 1_Tiny_Content_Framework.md
Last active October 1, 2024 16:26
Tiny Content Framework

Tiny Content Framework

About the project

This is a tiny content strategy framework focused on goals, messages, and branding. This is not a checklist. Use what you need and scrap the rest. Rewrite it or add to it. These topics should help you get to the bottom of things with clients and other people you work with.

Give me feedback on Twitter (@nicoleslaw) or by email ([email protected]).

Contents

@msabramo
msabramo / pastebin.workflow.applescript
Created January 1, 2011 01:33
Create a service workflow in Automator with a "Run AppleScript" action with this for an easy shortcut for posting to pastebin.com (See http://marc-abramowitz.com/archives/2011/01/02/os-x-service-for-posting-text-to-pastebin-com/)
-- pastebin.workflow.applescript
--
-- An automator workflow to copy selected text to pastebin.com
--
-- Created by Marc Abramowitz
-- December 5, 2010
-- version 1.0
on run {input}