Skip to content

Instantly share code, notes, and snippets.

View maxfunke's full-sized avatar
🦀

Baron GitGit maxfunke

🦀
View GitHub Profile
@maxfunke
maxfunke / .gitconfig
Last active March 13, 2024 02:21
.gitconfig aliases (adog, log, status)
[alias]
adog = log --all --decorate --oneline --graph
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
st = status --short
b = branch -vv
[core]
editor = code --wait
autocrlf = input
@maxfunke
maxfunke / nodePathHandling.js
Created February 2, 2017 09:15
Handling paths for different OS in Node.js - '/' or '\'
'use strict';
const FS = require('fs');
const OS = require('os');
let EXEC_PATH = process.argv[1];
let FILE_PATH = getFilePath(EXEC_PATH);
const FILE = JSON.parse(FS.readFileSync(FILE_PATH + '/myFile.json', 'utf8'));
function getFilePath(execPath){
let splitter = (OS.type() === "Windows_NT") ? "\\" : "/";
@maxfunke
maxfunke / consoleColors.js
Created February 2, 2017 09:19
color codes for console.log() in javascript / Node.js
'use strict';
let colorReset = "\x1b[0m"; //reset
let colorCode = (p) => {
if (p >= 100){
return "\x1b[31m"; //red
} else if (p < 100 && p >= 90){
return "\x1b[36m"; //cyan
}
return "\x1b[32m"; //green
@maxfunke
maxfunke / enableHyperV.ps1
Created May 5, 2017 10:52
Installieren von Hyper-V unter Windows 10
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@maxfunke
maxfunke / mssql-via-docker.sh
Last active March 22, 2018 18:03
MSSQL via docker (e.g. on OSX)
# pull mssql container
docker pull microsoft/mssql-server-linux
# run container, change password (strong enough) and port
docker run -d --name mssqlOnOSX -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=strongEnoughPassword123' -p 1433:1433 microsoft/mssql-server-linux
# see also:
# https://medium.com/@reverentgeek/sql-server-running-on-a-mac-3efafda48861
@maxfunke
maxfunke / javascript.json
Created March 22, 2018 18:05
VSCode Snippets for Jest testing
{
"jest_test_boilerplate": {
"prefix": "test_jest",
"body": [
"test(\"$1\", ($2) => {",
"\t$3",
"});"
],
"description": "basic boilerplate for a jest test case"
},
@maxfunke
maxfunke / PowershellBasics.md
Last active April 27, 2020 15:45
Basics for Powershell. From Pluralsight course.

Powershell Essentials

📝 ps1 boilerplate

Gather information for cmdlets and functions

Basically all cmdlets look like so: verb-noun

Basic process of information gathering

@maxfunke
maxfunke / Boilerpalte.ps1
Created July 3, 2018 10:05
Boilerplate for powershell scripts
#Requires -Version 3
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
.INPUTS
<Inputs if any, otherwise state None>
@maxfunke
maxfunke / Dockerfile
Created July 3, 2018 10:23
Golang - multistage docker images
# Multistage build
FROM golang:alpine as build
## stage1: build app, make use of /go/src
RUN mkdir /go/src/app
WORKDIR /go/src/app
## copy sources to build-image
ADD ./src/main.go /go/src/app
RUN go build -o /bin/app
@maxfunke
maxfunke / goBuilds_osDependent.md
Last active November 11, 2018 09:37
Golang build target OS dependent tools
  1. Naming file with build restriction foo_${GOOS}.go

  2. Adding build directives to the top of the file //+build linux,386 darwin windows

  3. on build system set $GOOS variable to target system (no matter which OS is your build system linux<>windows) GOOS = windows go build main.go

  4. cpu architecture can be set