Skip to content

Instantly share code, notes, and snippets.

View carlevans719's full-sized avatar

Carl Evans carlevans719

View GitHub Profile
$wd = $env:AZ_BATCH_TASK_WORKING_DIR
$exe = "$wd/batch-insights.exe"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::TLS12
Invoke-WebRequest -Uri $env:BATCH_INSIGHTS_DOWNLOAD_URL -OutFile $exe
# Delete if exists
$exists = Get-ScheduledTask | Where-Object {$_.TaskName -like "batchappinsights" };
@carlevans719
carlevans719 / sample_spec.json
Created January 14, 2019 21:48
Example of spec which would reproduce error lin apint/openapi-designer issue #354
{
"paths": {
"/{test}": {
"get": {
"operationId": "getTest",
"responses": {}
},
"x-oad-type": "operation"
},
"/second/{test}": {
@carlevans719
carlevans719 / .bash_aliases
Last active December 3, 2020 14:00
Bash Aliases / helper functions
# Bash helpers
alias '...'='cd ../..'
alias '....'='cd ../../..'
alias '.....'='cd ../../../..'
function announce () {
printf "\n###### $1 ######\n\n"
}
# SSH helpers
{
"plugins": [
"@babel/plugin-proposal-class-properties"
],
"ignore": [
"./.vscode",
"./node_modules",
"./dist"
]
}
@carlevans719
carlevans719 / index.ts
Created January 4, 2018 10:51
Conditional import/export based on locus in Meteor with typings
// these imports exist only in typescript-land (just importing types)
import * as _serverExports from './index.server'
import * as _clientExports from './index.client'
// Meteor for isClient / isServer
import { Meteor } from 'meteor/meteor'
// isomorphic imports
import { findByEmail } from './findByEmail'
@carlevans719
carlevans719 / update_services.js
Last active March 15, 2018 10:01
Create task definition revisions and update all services which use them AWS ECS
'use strict'
const child_process = require('child_process')
const spawn = child_process.spawn
const AWS = require('aws-sdk')
const ACCESS_KEY_ID = ''
const SECRET_ACCESS_KEY = ''
const PROFILE = ''
const REGION = 'eu-west-1'
@carlevans719
carlevans719 / killThreads.sh
Created January 4, 2018 09:34
Kill all threads of a process
#!/bin/bash
#### Version 1
kill -9 $(pidof liquidsoap)
#### Version 2
SKIPPED_FIRST_ROW=false
titles = ['miss', 'mr', 'mrs', 'ms', 'mx', 'dr', 'master', 'sir', 'prof']
genders = ['female', 'male', 'unspecified']
marital statuses = ['single', 'married', 'widowed', 'divorced']
nationalities = [
'Afghan',
'Albanian',
'Algerian',
'American',
'Andorran',
'Angolan',
*Git* is a SCM (Source Control Management) - you use it to make source code available to you and others from any computer. It also makes it easier to collaborate, handling "merges" (when two people try to change the same file).
*GitHub* is an online store where you can keep repositories (it also does other stuff, like issue tracking)
*Staging* (`git add`) is when you mark file(s) / folder(s) as being ready to commit
*Commititing* (`git commit`) is when you save the state of certain files/folders (which have been "staged") to the repository
*Pushing* (`git push`) is when you send up your local "commits" to the remote repository (the one stored on GitHub / other)
*Pulling* (`git pull`) is when you bring in commits from the remote repository to your local one
*Cloning* (`git clone`) is when you bring down a whole repo from GitHub to your computer
@carlevans719
carlevans719 / exampleUsage.js
Last active February 28, 2017 19:24
publish a relational dataset in meteor with a mongo backend
// invoked thus:
relationalPublish.call(this, {
collection: new Mongo.Collection('pens'),
collectionName: 'pens',
selector: { brand: 'bic' },
options: {limit: 500},
include: [{
collection: new Mongo.Collection('inks'),
collectionName: 'inks',
fieldName: 'inkType'