Skip to content

Instantly share code, notes, and snippets.

View minskmaz's full-sized avatar

minskmaz

  • San Francisco
View GitHub Profile
@minskmaz
minskmaz / Dockerfile
Created August 8, 2023 03:04 — forked from studiokeywi/Dockerfile
flygun
FROM node:latest
WORKDIR /app
COPY ./index.js ./
COPY ./package*.json ./
RUN npm ci
EXPOSE 8080
CMD ["npm", "start"]
module.exports = function(pwd, extra) {
var forge = require("node-forge");
forge.options.usePureJavaScript = true;
var EC = require('elliptic').ec;
return new Promise((resolve, reject) => {
var ec_p256 = new EC('p256');
if (!pwd)
@minskmaz
minskmaz / Dockerfile
Created October 24, 2020 06:00
Dockerfile for compiling tds-fdw postgres extension
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /
RUN apt update
RUN apt -y upgrade
RUN apt-get update
@minskmaz
minskmaz / auth.js
Created December 18, 2019 21:17
mithril - token authentication
if( tokenInHash ){
// User has just been authenticated!
m.route( body, '/profile', routes.authenticated )
}
else if( localToken ){
// We already have a token, could still be valid
m.route( body, '/login', routes.waiting )
validate( localToken ).then(
success => m.route( body, '/profile', routes.authenticated ),
@minskmaz
minskmaz / websocketsync.py
Created November 27, 2019 19:44
websocketsync protocol in python
#!/usr/bin/env python
# WS server example that synchronizes state across clients
import asyncio
import json
import logging
import websockets
logging.basicConfig()
@minskmaz
minskmaz / example.py
Created February 12, 2019 05:31
Zope Component getUtility call from Jinja2 template (whoa!)
# Zope Component Utilities are perfect for injecting up-to-date state/config from far away regions of your app
# To do so just don't __call__() the utility when you register it - register it as a method only but call it from your template
# Make sure to pass in your interface and utility function (zope.component.getUtility) to jinja - then profit!
'mytld.com':{
'config':{
'tld':'mytld.com',
'iface':IFWUtils,
'utilfunc':getUtility
}
@minskmaz
minskmaz / simplemitogen.py
Created May 27, 2018 23:49
get your mitogen on - Mitogen, an infrastructure code baseline that sucks less
import mitogen.master
import mitogen.utils
import logging
broker = mitogen.master.Broker()
router = mitogen.master.Router(broker)
def my_first_function():
try:
import socket
- hosts: 127.0.0.1
user: root
vars_files:
- vars.yml
tasks:
- name: Install required system packages.
apt: pkg={{item}} state=present update-cache=yes
with_items: system_packages
environment:
http_proxy: http://192.168.4.10:8080
{
"builders":[{
"type": "docker",
"image": "77fa34a8068f",
"pull": false,
"export_path": "image.tar"
}],
"provisioners":[
{
"type": "ansible-local",
{
"builders":[{
"type": "docker",
"image": "ubuntu:14.04",
"export_path": "image.tar"
}],
"provisioners":[
{
"type": "shell",
"environment_vars": [