This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -n "$BASH_VERSION" ]; then | |
# include .bashrc if it exists | |
if [ -f "$HOME/.bashrc" ]; then | |
. "$HOME/.bashrc" | |
fi | |
fi | |
export VISUAL='vim' | |
export EDITOR='vim' | |
export PYTHONSTARTUP="$HOME/.pystartup" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://medium.com/@henatyokotraveler/convert-json-file-with-line-break-to-csv-with-jq-command-577fe88c5bc1 | |
# but cleaned non-copy-paste friendly ligatures and injected spaces | |
jq '.some.filter | @csv' | sed 's/\\\\/\\/g' | sed 's/\\\"/\"/g' | sed 's/^"//g' | sed 's/"$//g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Teamcity agent full | |
[Service] | |
Type=simple | |
User=carlerik | |
Environment=JAVA_HOME=/home/carlerik/.sdkman/candidates/java/12.0.0-open | |
ExecStart=/home/carlerik/apps/teamCityBuildAgentFull/bin/agent.sh run | |
ExecStop=/home/carlerik/apps/teamCityBuildAgentFull/bin/agent.sh stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* eslint-disable no-console */ | |
const appInfoFile = `${__dirname}/../src/appinfo.js`; | |
const async = require('async'); | |
const cp = require('child_process'); | |
const fs = require('fs'); | |
const exec = cmd => cb => cp.exec(cmd, (err, stdout, _stderr) => cb(err, ('' || stdout).trim())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testutil.rules; | |
import ch.qos.logback.classic.Level; | |
import ch.qos.logback.classic.spi.ILoggingEvent; | |
import ch.qos.logback.core.Appender; | |
import ch.qos.logback.core.AppenderBase; | |
import org.junit.rules.ExternalResource; | |
import org.junit.rules.TestWatcher; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# @author Carl-Erik Kopseng [email protected] | |
MAP=/opt/TeamCity/buildAgent/work/directory.map | |
DIR=$(dirname $MAP) | |
sed -n -e '1,3d;1,/#/{/#/!p}' $MAP | \ | |
awk -v pwd=$PWD ' | |
{ | |
n = split($0, array, "->"); | |
proj = substr(array[1], 6) | |
tcdir = substr(array[2],2,16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Checks to see if the published NPM package has the files passed in as arguments | |
# Requirements: jq and npm | |
# `brew install jq` on macOS and `apt install jq` on Ubuntu | |
pkg=$(echo $(jq .name package.json)-$(jq .version package.json).tgz | sed 's/"//g') | |
files_to_check="$@" | |
main(){ | |
npm pack > /dev/null 2>&1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A debugging function that prints its arguments | |
* @returns {String} an identifier that shows the name of this function | |
*/ | |
function createConnFunc(name) { | |
/* eslint-disable no-console */ | |
return function connFunnFunc(...args) { | |
console.log(`${name}(${args.join(',')})`); | |
return `conn_${name}`; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {mount as enzymeMount, render as enzymeRender, shallow as enzymeShallow} from 'enzyme'; | |
import React from 'react'; | |
import JssProvider from 'react-jss/lib/JssProvider'; | |
export const generateClassName = (rule, styleSheet) => `${styleSheet.options.classNamePrefix}-${rule.key}`; | |
function consistentClassNameWrapper(func, overrides = {}) { | |
return function(children, ...opts) { | |
let wrapper = func(<JssProvider generateClassName={generateClassName}>{children}</JssProvider>, ...opts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run this on the playground by copy-pasting: https://www.typescriptlang.org/play | |
interface Vehicle { | |
brand: string; | |
drive(miles: number): void; | |
getMileage(): void; | |
} | |
interface IsPassengerCarrier { | |
carryingCapacity: number; |