Skip to content

Instantly share code, notes, and snippets.

View johnnyshankman's full-sized avatar
💀
stumbling thru the ether

Johnny Shankman johnnyshankman

💀
stumbling thru the ether
View GitHub Profile
@johnnyshankman
johnnyshankman / makeafileofanysize.sh
Created September 16, 2024 23:05
make a file of any size that's just padded with nothingness using mkfile (osx / unix)
mkfile -n 400k temp_file_name_of_400kb_file
mkfile -n 2g temp_file_name_of_10gb_file
{
"created_by": "johnny",
"description": "a cool text thing by johnny",
"name": "My Article: The Future Of Writing",
"attributes": [
{
"trait_type": "markdown",
"value": "hello *world*"
},
{
@johnnyshankman
johnnyshankman / svgdatauri.txt
Last active August 29, 2024 19:51
An svg that centers the text and pads it as best it can to fit on most screen/canvas sizes.
data:image/svg+xml,%3Csvg%20width%3D%22200%22%20height%3D%22200%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%0A%20%20%3Cstyle%3E%0A%20%20%20%20.title-container%20%7B%0A%20%20%20%20%20%20font-family%3A%20Arial%2C%20sans-serif%3B%20%0A%20%20%20%20%20%20font-size%3A%2012px%3B%20%0A%20%20%20%20%20%20fill%3A%20black%3B%0A%20%20%20%20%20%20text-align%3A%20center%3B%0A%20%20%20%20%20%20white-space%3A%20nowrap%3B%0A%20%20%20%20%20%20overflow%3A%20hidden%3B%0A%20%20%20%20%20%20text-overflow%3A%20ellipsis%3B%0A%20%20%20%20%20%20padding%3A%2010px%3B%0A%20%20%20%20%20%20box-sizing%3A%20border-box%3B%20%20%2F*%20Includes%20padding%20in%20the%20element%20size%20*%2F%0A%20%20%20%20%7D%0A%0A%20%20%20%20rect%20%7B%0A%20%20%20%20%20%20fill%3A%20white%3B%0A%20%20%20%20%20%20stroke%3A%20black%3B%0A%20%20%20%20%20%20stroke-width%3A%201%3B%0A%20%20%20%20%7D%0A%20%20%3C%2Fstyle%3E%0A%0A%20%20%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%22100%25%22%20height%3D%22100%25%22%20%2F%3E%0A%20%20%3CforeignObject%20x%3D%220%
data:text/markdown;utf8,%23%20h1%20Heading%208-)%0A%23%23%20h2%20Heading%0A%23%23%23%20h3%20Heading%0A%23%23%23%23%20h4%20Heading%0A%23%23%23%23%23%20h5%20Heading%0A%23%23%23%23%23%23%20h6%20Heading%0A%0A%0A%23%23%20Horizontal%20Rules%0A%0A___%0A%0A---%0A%0A***%0A%0A%0A%23%23%20Typographic%20replacements%0A%0AEnable%20typographer%20option%20to%20see%20result.%0A%0A(c)%20(C)%20(r)%20(R)%20(tm)%20(TM)%20(p)%20(P)%20%2B-%0A%0Atest..%20test...%20test.....%20test%3F.....%20test!....%0A%0A!!!!!!%20%3F%3F%3F%3F%20,,%20%20--%20---%0A%0A%22Smartypants%2C%20double%20quotes%22%20and%20'single%20quotes'%0A%0A%0A%23%23%20Emphasis%0A%0A**This%20is%20bold%20text**%0A%0A__This%20is%20bold%20text__%0A%0A*This%20is%20italic%20text*%0A%0A_This%20is%20italic%20text_%0A%0A~~Strikethrough~~%0A%0A%0A%23%23%20Blockquotes%0A%0A%0A%3E%20Blockquotes%20can%20also%20be%20nested...%0A%3E%3E%20...by%20using%20additional%20greater-than%20signs%20right%20next%20to%20each%20other...%0A%3E%20%3E%20%3E%20...or%20with%20spaces%20between%20arrows
@johnnyshankman
johnnyshankman / rsync.sh
Last active August 27, 2024 15:10
Copying files from music folder to rockbox with rsync
rsync --ignore-existing -v -P -r -h itunes /Volumes/IPOD/Music
#!/bin/bash
# Input parameters
folders=$1 # Comma-separated list of folders
packages=$2 # Comma-separated list of npm package names
versions=$3 # Comma-separated list of version strings
# Check if the user is logged into GitHub CLI
if ! gh auth status > /dev/null 2>&1; then
echo "You are not logged into GitHub CLI. Please run 'gh auth login' to authenticate then try again."
@johnnyshankman
johnnyshankman / godaddy-ssl-letsencrypt-zerossl-acme.md
Last active August 12, 2024 21:18
How To Setup SSL Encryption with Let's Encrypt On GoDaddy

How To Setup Free SSL Encryption with "Let's Encrypt" (aka "ZeroSSL") On GoDaddy

The guides online will tell you that this isn't easy, but it's actually really easy and only a simple process that takes about 10 minutes to complete.

This guide takes from raw shared hosting service with a domain attached to it and no HTTPS support, to full SSL support that auto-renews every 60 days for FREE.

The key is acme.sh

Thank you so much to that team. Support them if you can.

@johnnyshankman
johnnyshankman / Helper.sol
Last active February 24, 2024 18:20
How to find your ERC165 interface bytes4 using Remix IDE
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
// @dev: replace this interface with your ERC165 interface
interface SomeInterface is IERC165 {
function someFunction(uint256 id) external view returns (string memory);
}
@johnnyshankman
johnnyshankman / expectCustomRevertError.js
Last active May 2, 2023 16:59
Catch and assert the value of any custom error thrown by a smart contract in Truffle unit testing by using just the built in web3.js module
const expectCustomRevertError = async function(promise, expectedErrorSignature) {
try {
await promise;
} catch (error) {
const encoded = web3.eth.abi.encodeFunctionSignature(expectedErrorSignature);
const returnValue = Object.entries(error.data).filter(it=>it.length>1).map(it=>it[1]).find(it=>it!=null && it.constructor.name==="Object" && "return" in it).return
assert.equal(returnValue, encoded);
return;
}
expect.fail('Expected an exception but none was received');
@johnnyshankman
johnnyshankman / index.html
Created March 6, 2022 23:47
Web Audio API (Sinewave)
<div class="container">
<header>
<h1>Web Audio API (Sinewave)</h1>
<h2>Music: Kavinsky ft. The Weekend - Odd Look</h2>
<p id="not-supported"></p>
</header>
<canvas id="visualizer" width="956" height="100"></canvas>
<section class="status">
<span>Audio: </span><span id="audio-status"></span>
</section>