Skip to content

Instantly share code, notes, and snippets.

View cmbuckley's full-sized avatar

Chris Buckley cmbuckley

View GitHub Profile
@cmbuckley
cmbuckley / effects.md
Last active February 28, 2024 11:12
I constantly forget which is which out of most of these.
@cmbuckley
cmbuckley / pwned.sh
Created February 6, 2024 17:27
Quick and dirty script to check Have I Been Pwned
#!/bin/bash
echo 'This script checks the HIBP API to see if a password has been breached.'
echo 'Only the first 5 characters of the SHA1 hash of the password leave the device.'
echo
echo -n 'Password: '
read -s password
hash=$(echo -n "$password" | sha1sum | cut -c 1-40)
@cmbuckley
cmbuckley / stack-streak.js
Last active January 18, 2023 11:58
How close am I to the Fanatic badge on Stack Overflow?
$.get('/users/daily-site-access/' + StackExchange.options.user.userId, t => {
eval(t.match(/var visited = {.+};/)[0]);
const firstYear = Object.keys(visited)[0],
firstMonth = Object.keys(visited[firstYear])[0],
firstDay = Object.keys(visited[firstYear][firstMonth])[0],
date = new Date(firstYear, firstMonth - 1, firstDay),
today = Date.now();
let days = [], seq = 0, streaks = [0], fewest = 100, fewestDate;
do {
days[++seq] = !!visited[date.getFullYear()][date.getMonth() + 1][date.getDate()];
<?php
$request = <<<EOS
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://schemas.example.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<?php
header('Location: https://setcookie.net');
@cmbuckley
cmbuckley / 617179.php
Last active September 29, 2022 00:39
<?php
$headers = [
"Content-Security-Policy: style-src 'self'",
"Content-Type: application/json",
];
foreach ($headers as $header) {
header($header);
}
const config = {
'source.email@gmail.com': {
prefix: 'Source',
color: CalendarApp.EventColor.PALE_RED,
visibility: 'private'
},
};
function onCalendarChanged(trigger) {
copyEvents(trigger.calendarId);
@cmbuckley
cmbuckley / amazon-cards.bookmarklet.js
Created December 14, 2021 00:43
Amazon Cards Bookmarklet
javascript:(function (doc) {
let cards = {
1111: 'Card #1',
2222: 'Card #2',
};
doc.querySelectorAll('[data-number]').forEach(function (card) {
card.parentNode.querySelector('span').innerText = cards[card.dataset.number]);
});
})(document);
@cmbuckley
cmbuckley / .gitattributes
Last active December 7, 2021 21:11
Using gron as an external git diff driver
*.json diff=gron