Skip to content

Instantly share code, notes, and snippets.

View shgysk8zer0's full-sized avatar
💭
I may be slow to respond.

Chris Zuber shgysk8zer0

💭
I may be slow to respond.
View GitHub Profile
@shgysk8zer0
shgysk8zer0 / README.md
Last active December 2, 2021 08:00
<github-gist> class for lazy-loading Gists

<github-gist> Instructions

This is a custom element / web component built using vanilla JavaScript to embed GistHub Gists into a webpage without having to worry about the inline scripts which call document.write(). It can be configured to lazy-load using loading="lazy" and styled with CSS through the github-gist & github-gist::part(embed) selectors.

Under-the-hood it creates an <iframe> using:

<iframe srcdoc="..." sandbox="allow-scripts allow-popups" width="..." height="..." referrerpolicy="no-referrer"></iframe>
@shgysk8zer0
shgysk8zer0 / gist.js
Last active December 2, 2021 00:02
A demo of <github-gist> usage (See https://codepen.io/shgysk8zer0/full/jOGEJRj)
const protectedData = new WeakMap();
function render(target) {
const { user, gist, file, height, width } = target;
const { shadow } = protectedData.get(target);
const iframe = document.createElement('iframe');
const script = document.createElement('script');
const link = document.createElement('link');
const src = new URL(`/${user}/${gist}.js`, 'https://gist.github.com');
const controller = new AbortController();
@shgysk8zer0
shgysk8zer0 / daily-css-images-09-calendar.markdown
Created November 12, 2019 16:57
Daily CSS Images | 09 | Calendar
@shgysk8zer0
shgysk8zer0 / .editorconfig
Last active February 5, 2019 23:54
Signature Canvas
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
@shgysk8zer0
shgysk8zer0 / index.html
Last active September 12, 2018 04:52
Share API shim
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Share API Shim Demo</title>
<script type="aplication/javascript" src="/path/to/dialog-shim.js"></script>
<script type="module" src="index.js" async=""></script>
<script type="application/javascript" async="" nomodule=""></script>
</head>
<body>
@shgysk8zer0
shgysk8zer0 / squares-sum.mml
Last active April 21, 2017 15:15
Squares as sum proof
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<semantics>
<mtable>
<mtr>
<mtd>
<mrow>
<mi>x</mi>
<mo stretchy="false">∈</mo>
<mi mathvariant="normal">ℕ</mi>
</mrow>
@shgysk8zer0
shgysk8zer0 / README.md
Created February 10, 2017 06:28
Generate random images in PHP

Generate random images in PHP

sample

Why?

  • Because you can
  • Because you have time to spare
  • Maybe you think they look cool or want to save them for wallpapers or something
  • Maybe it reminds you of that one time... You know which time I'm talking about

Requirements

@shgysk8zer0
shgysk8zer0 / index.php
Last active September 8, 2020 14:49
RSA public key cryptography using PHP >= 7
<?php
//namespace shgysk8zer0\PHPCrypt;
const PUBLIC_KEY = './pub.pem';
const PRIVATE_KEY = './priv.pem';
const PUB2 = './pub2.pem';
const PRIV2 = './priv2.pem';
const PASSWORD = 'dgbdkfjg';
const PASSWORD2 = 'dfgnduyho';
@shgysk8zer0
shgysk8zer0 / clipcrypt
Last active March 28, 2020 19:03
Bash script to decrypt data from clipboard
#!/bin/bash
# Save this script to anywhere in `$PATH`, but ideally as `/usr/local/bin/clipcrypt`
# Grant read/execute permissions `chmod 755 /usr/local/bin/clipcrypt`
# Optionally, make root the owner `sudo chown root:root /usr/local/bin/clipcrypt`
xclip -selection clipboard -o | gpg -d | xclip -selection clipboard

Keybase proof

I hereby claim:

  • I am shgysk8zer0 on github.
  • I am shgysk8zer0 (https://keybase.io/shgysk8zer0) on keybase.
  • I have a public key whose fingerprint is C885 8E4F 4633 F3E5 F364 B25A 5399 86BB 2E23 D409

To claim this, I am signing this object: