Skip to content

Instantly share code, notes, and snippets.

View KrauseStefan's full-sized avatar

Stefan Krause-Kjær KrauseStefan

  • Systematic
  • Denmark
View GitHub Profile
@KrauseStefan
KrauseStefan / git-options.sh
Created November 29, 2020 12:29
git configuration options
git config --global format.pretty '%h %aN - %Cgreen%s %Creset: %Cred%ar %C(reset)%C(auto)%d%C(reset)'
# List certificates
certutil -d $HOME/.pki/nssdb -L
# Add certificate
# Tested with base64 incoded cert
# Source: https://grox.net/sysadm/unix/chrome.import_ca_cert
certutil -d sql:$HOME/.pki/nssdb -A -n '<PrettyName>' -i <path to cert>.crt -t TCP,TCP,TCP
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\w\[\033[00m\] [\[\033[01;34m\]$(__git_ps1 "%s")\[\033[00m\]]$ '

If the order of lines is not important##

Sort lines alphabetically, if they aren't already, and perform these steps:
(based on this related question: https://stackoverflow.com/q/1573361/3258851)

  1. Control+F

  2. Toggle "Replace mode"

  3. Toggle "Use Regular Expression" (the icon with the .* symbol)

@KrauseStefan
KrauseStefan / git-show-big-files.sh
Created May 6, 2020 07:20 — forked from mcxiaoke/git-show-big-files.sh
Find large files in git repository
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
@KrauseStefan
KrauseStefan / lockFile.ps1
Created August 22, 2019 07:12
Lock file from powershell
[System.IO.FileStream]::new("C:\file-path\filename.txt", [System.IO.FileMode]::Open)
gradle.taskGraph.afterTask { task ->
StringBuffer taskInfo = new StringBuffer()
taskInfo << """"-------------
name:$task.name group:$task.group : $task.description
conv:$task.convention.plugins
inputs:
"""
task.inputs.files.each{ it ->
taskInfo << "${it.absolutePath}\n"
}
@KrauseStefan
KrauseStefan / README-kotlin-dsl-deps-ext-intro.md
Created January 15, 2019 08:26 — forked from xinthink/README-kotlin-dsl-deps-ext-intro.md
Tiny buildSrc file help defining reusable dependencies when using kotlin-dsl.

If you're using [kotlin-dsl] in a multi-project manner, you may want to define all the dependencies in one place. You can put the files into buildSrc, define dependencies in a compat way like this:

extra.deps {
    "kt"("stdlib-jre7")
    "auto" {
        "common"("com.google.auto:auto-common:0.8")
        "service"("com.google.auto.service:auto-service:1.0-rc3")
    }
 "gson"("com.google.code.gson:gson:2.8.0")
@KrauseStefan
KrauseStefan / clean_code.md
Created September 5, 2018 10:01 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@KrauseStefan
KrauseStefan / gist:4b45d3373caf1d5d33d48b9794708fa0
Created February 8, 2018 15:45 — forked from daicham/gist:4528511
zip/unzip on Powershell (depends on Ionic.Zip.dll)
function zip ($zipFilePath, $targetDir) {
# load Ionic.Zip.dll
[System.Reflection.Assembly]::LoadFrom(path\to\Ionic.Zip.dll)
$encoding = [System.Text.Encoding]::GetEncoding("shift_jis") # 日本語のファイルを扱うために必要
$zipfile = new-object Ionic.Zip.ZipFile($encoding)
$zipfile.AddDirectory($targetDir)
if (!(test-path (split-path $zipFilePath -parent))) {
mkdir (split-path $zipFilePath -parent)