Skip to content

Instantly share code, notes, and snippets.

@speier
speier / prompt.js
Created November 24, 2023 23:41 — forked from zckly/prompt.js
gpt-4-v skateboarding coach prompt
// model: gpt-4-vision-preview
const input = 'can you help me land this skateboarding trick?'
const frames = [
// Frames should be a list of image URLs or bytes
]
const messages = [
...messages,
@speier
speier / countdown.js
Created June 18, 2019 07:34
JS countdown
function countdown(start) {
return [...Array(start + 1).keys()].reverse()
}
@speier
speier / 1_app.js
Last active October 7, 2017 21:58
playing with hyperapp routing
import { app } from 'hyperapp';
import { router } from './router';
import routes from './routes';
import state from './state';
import actions from './actions';
const routable = router(routes);
app(routable)({ state, actions }).init(); // init is just an action, not related to routing
@speier
speier / getComments.js
Created September 22, 2017 10:41
get code comments
const acorn = require('acorn');
const json5 = require('json5');
const getComments = (input) => {
const opts = {
onComment: []
};
try {
const ast = acorn.parse(input, opts);
@speier
speier / gist:0636271079b1f719353745b903c9013e
Created September 19, 2016 14:55
check certs end date
for i in *.pem; do echo -n "$i >>> "; openssl x509 -enddate -noout -in $i; done
# /etc/systemd/system/docker.service.d/10-base.conf
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon \
-H fd:// \
-H tcp://0.0.0.0:2376 \
-H unix:///var/run/docker.sock \
--dns-search=service.consul \
--dns=10.135.27.153
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/
<script type="text/javascript" src="http://www.sveido.com/mermaid/dist/mermaid.full.min.js"></script>
<div class="mermaid">
graph LR;
D(Developer)-->|push|GH(GitHub);
GH-->|test|C(CircleCI);
C-->|build|P(Private Registry);
P---|store|G(GCS);
D-->|deploy|K(Kubernetes Master);
P---K;

Keybase proof

I hereby claim:

  • I am speier on github.
  • I am speier (https://keybase.io/speier) on keybase.
  • I have a public key whose fingerprint is 0D74 6267 5850 AF29 09EA FD27 D938 278D 8250 3A95

To claim this, I am signing this object:

@speier
speier / clock.js
Created October 24, 2013 19:58
dead simple js clock (using moment.js)
function displayTime() {
var time = moment().format('HH:mm:ss');
$('#clock').html(time);
setTimeout(displayTime, 1000);
}
$(document).ready(function() {
displayTime();
});