Skip to content

Instantly share code, notes, and snippets.

View fatso83's full-sized avatar
🐢
Two toddlers. Very little time for OSS after work hours. File a PR!

Carl-Erik Kopseng fatso83

🐢
Two toddlers. Very little time for OSS after work hours. File a PR!
View GitHub Profile
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"
@fatso83
fatso83 / gist:85a4934f6fe25ff34af389c4104ad14c
Created September 17, 2020 17:02
jq to csv with newlines
# 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'
[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
#!/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()));
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;
#!/bin/sh
# @author Carl-Erik Kopseng carlerik@gmail.com
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)
#!/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;
/**
* 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}`;
};
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);
@fatso83
fatso83 / car-module.ts
Created June 21, 2019 08:18
Module pattern in TypeScript; having classes doesn't mean you have to use them at all times
// 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;