Skip to content

Instantly share code, notes, and snippets.

@ctataryn
ctataryn / jq.md
Created June 24, 2019 22:48
Turn array of objects into map using jq

Given:

[{id: "1234", name: "foo"}, {id: "5678", name: "bar"}, ... ]

jq: map( { (."id"): (.) }) | add

Produces:

{
@ctataryn
ctataryn / gvim
Last active January 24, 2020 17:34
A script that lets you execute gVim for Windows within WSL
#!/bin/bash
#################################################################
# place this script on your $PATH and chmod it to be executable
#################################################################
# assumes C:\ is mounted to /c, change any occurance of /c to /mnt/c if
# you are using the default WSL mount point for C:\
CMD='/c/Windows/System32/cmd.exe'
#location of gvim
GVIM='/c/Program Files (x86)/Vim/vim81/gvim.exe'
Nov 5 13:38:41 csdev-VirtualBox gnome-do.desktop[2227]: [Error 13:38:41.482] [UniverseManager] Error while updating item source "Firefox Places": Specified cast is not valid.
Nov 5 13:38:41 csdev-VirtualBox gnome-do.desktop[2227]: [Error 13:38:41.485] [UniverseManager] Error while updating item source "Torrents": Cannot access Transmission RPC service
Nov 5 13:38:41 csdev-VirtualBox gnome-do.desktop[2227]: Could not locate Tomboy on D-Bus. Perhaps it's not running?
Nov 5 13:39:01 csdev-VirtualBox CRON[4879]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Nov 5 13:39:04 csdev-VirtualBox systemd[1]: Starting Clean php session files...
Nov 5 13:39:04 csdev-VirtualBox systemd[1]: Started Clean php session files.
Nov 5 13:39:09 csdev-VirtualBox nm-openvpn[2423]: [gateway.crowdscriber.com] Inactivity timeout (--ping-restart), restarting
Nov 5 13:39:09 csdev-VirtualBox nm-openvpn[2423]: SIGUSR1[soft,ping-restart] received, process restar
@ctataryn
ctataryn / bitbucket_error.html
Created March 7, 2018 15:09
Delete Branch Error
<!DOCTYPE html>
<html lang="en">
<head>
<meta id="bb-bootstrap" data-current-user="{&quot;username&quot;: &quot;ctataryn&quot;, &quot;displayName&quot;: &quot;Craig Tataryn&quot;, &quot;uuid&quot;: &quot;{f8a38a77-e894-4aef-9b81-42b36588feb7}&quot;, &quot;firstName&quot;: &quot;Craig Tataryn&quot;, &quot;hasPremium&quot;: false, &quot;lastName&quot;: &quot;&quot;, &quot;avatarUrl&quot;: &quot;https://bitbucket.org/account/ctataryn/avatar/32/?ts=1520435034&quot;, &quot;isTeam&quot;: false, &quot;isSshEnabled&quot;: true, &quot;isKbdShortcutsEnabled&quot;: true, &quot;id&quot;: 1160200, &quot;isAuthenticated&quot;: true}"
data-atlassian-id="557058:bb96956a-b733-48f9-884c-c2a5a1d384e4" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8">
var schema = `
enum Gender {
MALE
FEMALE
}
type Movie {
id: ID!
title: String!
year: Int
actors: [Actor]
from("direct:saveFile")
.transform()
.simple("Content Uploaded")
.to("file:outbox?fileName=myFile.pdf")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "text/plain");
}
rest("/validate")
.post()
.consumes(MediaType.APPLICATION_PDF_VALUE)
.produces(MediaType.TEXT_PLAIN_VALUE)
.to("direct:saveFile");
from("direct:saveFile")
.transform()
.simple("Content Uploaded")
.to("file:outbox?fileName=myFile.pdf")
import Ember from 'ember';
import ENV from '../config/environment';
export default Ember.Service.extend({
// .
// .
// .
chunkStateRejected: 'REJECTED',
chunkStateAssigned: 'ASSIGNED',
chunkStateUnassigned: 'UNASSIGNED',
@ctataryn
ctataryn / ember_problem.js
Created July 29, 2017 15:15
Problem with constants service use in a template
// /app/templates/create-account.hbs
{{#if constants.allowNewRegistration}}
<form {{action 'createAccount' on='submit'}}>
{{/if}}
// /app/controllers/create-account.js
export default Ember.Controller.extend( {
ajax: Ember.inject.service(),
$ berks upload -d
I, [2017-05-24T10:29:21.244742 #13780] INFO -- : Checking if lockfile is trusted
D, [2017-05-24T10:29:21.244742 #13780] DEBUG -- : Checking tprmb (>= 0.0.0)
D, [2017-05-24T10:29:21.246742 #13780] DEBUG -- : Using 'chefignore' at 'C:/workspace/chef/cookbooks/tprmb/chefignore'
D, [2017-05-24T10:29:21.260742 #13780] DEBUG -- : Detected