Skip to content

Instantly share code, notes, and snippets.

Ben Alman cowboy

Block or report user

Report or block cowboy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cowboy
cowboy / black-hole-pixel.css
Created Apr 17, 2019
one pixel from the black hole image in css, zoomed in
View black-hole-pixel.css
body {
color: #000;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am cowboy on github.
  • I am cowboy (https://keybase.io/cowboy) on keybase.
  • I have a public key ASCStQH9JCVUsg2ijSRIKEkz9IfqOEi40cEDadZQHHORbgo

To claim this, I am signing this object:

@cowboy
cowboy / index.html
Last active Oct 21, 2018
/r/megalinks base64+bold text decoder
View index.html
<div id=content>
<div id=bm-link-container>
<p>Bookmarklet <em>(drag this to your bookmarks bar)</em></p>
<span id=bm-link></span>
</div>
<div id=bm-code-container>
<p>Bookmarklet Code <em>(processed by babel and URIencoded)</em></p>
<textarea id=bm-code readonly></textarea>
</div>
<div id=bm-source-container>
@cowboy
cowboy / bookmarklet.js
Last active Mar 16, 2018
reddit megalinks: attempt to base64 decode all words 16+ chars in length
View bookmarklet.js
javascript:(function()%7B%5B...document.querySelectorAll('.usertext-body%20*')%5D.forEach(p%20%3D%3E%5B...p.childNodes%5D.filter(n%20%3D%3E%20n.nodeType%20%3D%3D%3D%203).forEach(n%20%3D%3E%20%7Bconst%20re%20%3D%20%2F%5CS%7B16%2C%7D%2Fg%3Bif%20(re.test(n.nodeValue))%20%7Btry%20%7Blet%20isHtml%2C%20child%3Bconst%20s%20%3D%20n.nodeValue.replace(re%2C%20s%20%3D%3E%20%7Bs%20%3D%20atob(s)%3Bif%20(%2F%5Ehttps%3F%3A%5C%2F%5C%2F%2F.test(s))%20%7Bs%20%3D%20%60%3Ca%20href%3D%22%24%7Bs%7D%22%20target%3D_blank%3E%24%7Bs%7D%3C%2Fa%3E%60%3BisHtml%20%3D%20true%3B%7Dreturn%20s%3B%7D)%3Bif%20(isHtml)%20%7Bconst%20tmp%20%3D%20document.createElement('div')%3Btmp.innerHTML%20%3D%20s%3Bchild%20%3D%20document.createDocumentFragment()%3B%5B...tmp.childNodes%5D.forEach(c%20%3D%3E%20child.append(c))%3B%7D%20else%20%7Bchild%20%3D%20document.createTextNode(s)%3B%7Dp.replaceChild(child%2C%20n)%3B%7D%20catch%20(e)%20%7B%7D%7D%7D))%7D)()
View Dockerfile
FROM ubuntu
RUN apt-get update
RUN apt-get install -y build-essential curl
# NodeJS >= 6.0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
# ttfautohint
@cowboy
cowboy / mock-axios.js
Last active Jun 9, 2019
axios mocking via interceptors
View mock-axios.js
import axios from 'axios'
let mockingEnabled = false
const mocks = {}
export function addMock(url, data) {
mocks[url] = data
}
@cowboy
cowboy / E12-resistors.txt
Last active Dec 15, 2017
E12 resistors from tayda
View E12-resistors.txt
A-2754 | 0.47 Ohm 1/4W 1% Metal Film Resistor Royal OHM Top Quality
A-2244 | 1 OHM 1/4W 1% Metal Film Resistor
A-2576 | 1.2 OHM 1/4W 1% Metal Film Resistor
A-2316 | 1.5 OHM 1/4W 1% Metal Film Resistor
A-2757 | 1.8 Ohm 1/4W 1% Metal Film Resistor
A-2600 | 2.2 OHM 1/4W 1% Metal Film Resistor
A-2602 | 2.7 OHM 1/4W 1% Metal Film Resistor
A-2189 | 3.3 OHM 1/4W 1% Metal Film Resistor
A-2311 | 3.9 OHM 1/4W 1% Metal Film Resistor Royal OHM Top Quality
A-2308 | 4.7 OHM 1/4W 1% Metal Film Resistor
@cowboy
cowboy / bird-map.js
Created Oct 27, 2017
i made a bird map
View bird-map.js
'bird'
.split(/^(.)(.)(.)/)
.map(''.constructor.call.bind(''.repeat))
.filter(''.constructor)
.map(''.constructor.call.bind(''.charCodeAt))
.map(n=>n<100?100:n<101?107:n<106?111:n)
.map(''.constructor.fromCharCode)
.join('')
@cowboy
cowboy / paperclips.js
Last active Sep 14, 2018
Universal Paperclips: stuff to paste into console http://www.decisionproblem.com/paperclips
View paperclips.js
_toggles = {}
makeToggle = (id, fn, delay = 250) => {
const elem = document.querySelector('#' + id)
elem.onclick = () => {
if (_toggles[id]) {
clearInterval(_toggles[id])
_toggles[id] = null
} else {
_toggles[id] = setInterval(() => elem.disabled || fn(), delay)
}
@cowboy
cowboy / synth.cpp
Created Sep 14, 2017 — forked from genericpenguin/synth.cpp
Arduino Synth
View synth.cpp
/* Arduino Synth from
https://janostman.wordpress.com/2016/01/15/how-to-build-your-very-own-string-synth/
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
You can’t perform that action at this time.