npm install funcoffee
require('funcoffee').expose global
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
#!/bin/sh | |
if [ "$#" -eq 1 ]; then stdinmsg=$(cat); fi | |
exec <"$0" || exit; read v; read v; read v; exec /usr/bin/osascript - "$@" "$stdinmsg"; exit | |
-- another way of waiting until an app is running | |
on waitUntilRunning(appname, delaytime) | |
repeat until my appIsRunning(appname) | |
tell application "Messages" to close window 1 | |
delay delaytime | |
end repeat |
#!/usr/bin/env node | |
var path = require('path') | |
var fs = require('fs') | |
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); | |
require(lib + '/awslambda.js').start_runtime(); | |
This gist is deprecated in favor of https://github.com/ninenines/cowboy/blob/master/doc/src/guide/specs.asciidoc which has a formatted version at https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/
(def stats-graph
{:n (fnk [xs] (count xs))
:m (fnk [xs n] (/ (sum identity xs) n))
:m2 (fnk [xs n] (/ (sum #(* % %) xs) n))
:v (fnk [m m2] (- m2 (* m m)))})
#!/usr/bin/env osascript | |
# usage: sendmail.app from@me.com to@you.com,and@you.com "have you seen this?" "a nice way to send mail/attachment from the shell in osx (if you have configured Mail.app) https://gist.github.com/andreineculau/38f6160cc9aa11956953" | |
on theSplit(theString, theDelimiter) | |
-- save delimiters to restore old settings | |
set oldDelimiters to AppleScript's text item delimiters | |
-- set delimiters to delimiter to be used | |
set AppleScript's text item delimiters to theDelimiter | |
-- create the array |
#!/usr/bin/env bash | |
# Map Caps Lock key to Left Control key | |
# https://developer.apple.com/library/content/technotes/tn2450/_index.html | |
# This doesnt work. Reverts on restart | |
# hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}' | |
# References: | |
# https://github.com/mathiasbynens/dotfiles/issues/310 | |
# https://gist.github.com/scottstanfield/0f8ce63271bebfb5cf2bb91e72c71f91 | |
# The last link didnt work for me on Sierra or High Sierra. I could not find IOHIDKeyboard but |
'use strict'; | |
var net = require('net'); | |
var repl = require('repl'); | |
var util = require('util'); | |
var awslambda = require('./build/Release/awslambda'); | |
const BASE_CONTEXT = Object.freeze({ | |
logGroupName : process.env['AWS_LAMBDA_LOG_GROUP_NAME'], | |
logStreamName : process.env['AWS_LAMBDA_LOG_STREAM_NAME'], | |
functionName : process.env['AWS_LAMBDA_FUNCTION_NAME'], |
import boto3 | |
session = boto3.Session(profile_name='ariancho') | |
s3_client = session.client('s3') | |
display_name = s3_client.list_buckets()['Owner']['DisplayName'] | |
print(display_name) | |
for bucket in s3_client.list_buckets()['Buckets']: | |
print(s3_client.get_bucket_acl(Bucket=bucket['Name'])['Owner']['DisplayName']) |