Skip to content

Instantly share code, notes, and snippets.

View cjonstrup's full-sized avatar
💭
I may be slow to respond.

Carsten Jonstrup cjonstrup

💭
I may be slow to respond.
View GitHub Profile
@cjonstrup
cjonstrup / ubuntu22.md
Last active June 1, 2022 08:11
Ubuntu 22

Ubuntu 22 setup

Overview

Look at one of the following topics to learn more

Common

Basic packages to install

#Ssh
ssh-keygen -t ed25519 -C "<comment>"
#PHP
sudo apt install php8.1-cli
#Tools
sudo apt -y install sysstat htop zsh apt tig git vim curl unzip p7zip unrar composer npm nodejs
#Zsh
@cjonstrup
cjonstrup / gitclean
Created April 29, 2020 04:39
Delete local branches that are merged
#!/bin/bash
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
git checkout master && git pull --prune --all && git branch --merged | grep -vE "^\*|master" | xargs -r git branch -d
git checkout $CURRENT_BRANCH
@cjonstrup
cjonstrup / fedora3x.txt
Last active March 30, 2022 12:05
Fedora 3x - install
#System setup
sudo visudo //remove ask for password for wheel users
#Install vim
sudo dnf -y install vim
#Use fast mirror
sudo echo 'fastestmirror=true' >> /etc/dnf/dnf.conf
#Disable firewall
@cjonstrup
cjonstrup / User.php
Created March 17, 2019 20:25
Slack - Laravel
class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable;
const SLACK_CHANNEL_WWW = 'xxx';
const SLACK_CHANNEL_BACKEND = 'xxx';
protected $slackChannels= [
self::SLACK_CHANNEL_WWW,
self::SLACK_CHANNEL_BACKEND,
@cjonstrup
cjonstrup / .gitconfig
Created March 13, 2019 22:07
gitconfig
[user]
name = xxx
email = [email protected]
[core]
whitespace = trailing-space,space-before-tab
editor = vim
[diff]
renames = copy
[color]
diff = auto
@cjonstrup
cjonstrup / import.cs
Last active March 13, 2019 20:35
C# Postgresql - Fast import
using (var connection = HeroukoPostgresql)
{
var watch = System.Diagnostics.Stopwatch.StartNew();
connection.Open();
var trans = connection.BeginTransaction();
try
{
ExecuteNonQuery("TRUNCATE xxx", connection);
@cjonstrup
cjonstrup / NaturalSort.cs
Created October 23, 2015 14:51 — forked from KennyEliasson/NaturalSort.cs
Natural Sort c#
public class NaturalSortComparer : IComparer<string>, IDisposable
{
private bool isAscending;
public NaturalSortComparer(bool inAscendingOrder = true)
{
this.isAscending = inAscendingOrder;
}
public int Compare(string x, string y)
export PS1="________________________________________________________________________________\n| \w @ \h (\u) \n| => "
export PS2="| => "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
zipf () { zip -r "$1".zip "$1" ; }
# extract: Extract most know archives with one command
# ---------------------------------------------------------
@cjonstrup
cjonstrup / Laravel\app\commands\ViewsCommand.php
Last active August 1, 2019 21:17
Clear Laravel 4.* app/storage/views artisan views:clear
<?php
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
class ViewsCommand extends Command {
/**
* The console command name.
*
* @var string