Skip to content

Instantly share code, notes, and snippets.

View microadam's full-sized avatar

Adam Duncan microadam

View GitHub Profile
@microadam
microadam / example
Created February 10, 2023 10:45
dynamodb
const generateUpdateQueryExpression = (fields: Partial<TableStructure>) => {
const exp = {
UpdateExpression: "SET",
ExpressionAttributeNames: {} as ObjectWithProperties,
ExpressionAttributeValues: {} as ObjectWithProperties,
};
Object.entries(fields).forEach(([key, item]) => {
const keyParts = key.split(".");
const valueKey = keyParts[keyParts.length - 1];
const attributeNames = `#${keyParts.join(".#")}`;
@microadam
microadam / Dockerfile
Created February 8, 2023 13:36
android-sdk
FROM openjdk:8
# Install Git and dependencies
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y file git curl zip libncurses5:i386 libstdc++6:i386 zlib1g:i386 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt
# Set up environment variables
openssl genrsa -out saml.pem 1024
openssl req -new -key saml.pem -out saml.csr
openssl x509 -req -in saml.csr -signkey saml.pem -out saml.crt
@microadam
microadam / admin-client.js
Created May 17, 2018 15:02
Primus Client / Server
const Primus = require('primus')
const Socket = Primus.createSocket({ parser: 'binary' })
const client = new Socket('http://localhost:3030', { transport: { headers: { 'admin': 'true' } } })
client.on('open', () => {
console.log('opened!')
client.on('data', data => {
console.log(data)
})
client.write('Hello')
DB:
Honour:
{ id: ''
, tournamentId: ''
, slug: 'runner-up || winner || mvp'
, priority: ''
}
{ "scripts":
{ "prepare": "nave use 4.3.1 npm install"
},
"dependencies":
{ "multi-glob": "1.0.1"
}
}
#!/bin/sh
# This program contains parts of narwhal's "sea" program,
# as well as bits borrowed from Tim Caswell's "nvm"
# nave install <version>
# Fetch the version of node and install it in nave's folder.
# nave use <version>
# Install the <version> if it isn't already, and then start
{
"name": "navy-captain",
"version": "0.0.5",
"from": "navy-captain@",
"resolved": "https://registry.npmjs.org/navy-captain/-/navy-captain-0.0.5.tgz",
"dependencies": {
"async": {
"version": "0.2.10",
"from": "async@~0.2.9",
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz"
@microadam
microadam / .jscsrc
Created April 24, 2014 19:46
Example .jscsrc
{ "excludeFiles":
[ "node_modules/**"
, "coverage"
]
, "requireLineFeedAtFileEnd": true
, "disallowMultipleLineBreaks": true
, "requireMultipleVarDecl": true
, "disallowEmptyBlocks": true
, "disallowSpaceAfterObjectKeys": true
, "disallowCommaBeforeLineBreak": true
@microadam
microadam / .jshintrc
Last active August 29, 2015 14:00
Example .jshintrc
{ "asi": true
, "boss": true
, "browser": true
, "camelcase": true
, "curly": false
, "devel": false
, "devel": true
, "eqeqeq": true
, "eqnull": true
, "es5": false