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 / EmbeddedResourceTypes.cs
Created July 19, 2013 09:16
ASP.NET MVC embedded views and virtual path provider
using System.Collections.Generic;
using System.IO;
namespace Portal.Common.EmbeddedResources
{
public static class EmbeddedResourceTypes
{
public static string GetContentType(string path)
{
return MimeTypes[Path.GetExtension(path)];
@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();
});
@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);

Backend Architectures

ARCHITECTURES

ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats

@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
@speier
speier / pre-push.sample
Created October 8, 2013 14:23
git's default pre-push sample
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done