Skip to content

Instantly share code, notes, and snippets.

View dynnamitt's full-sized avatar
:atom:
yolo

Kjetil Midtlie dynnamitt

:atom:
yolo
  • Norway
View GitHub Profile
@dynnamitt
dynnamitt / gui-mergetool
Created October 23, 2012 08:37
GUI mergetool setup
sudo aptitude install meld; git config --global merge.tool meld
@dynnamitt
dynnamitt / home-status
Created October 23, 2012 17:58
Home folder overview
cd; du -hd1 | sort -h
@dynnamitt
dynnamitt / nice-git-log
Created October 30, 2012 09:02
nice git log
git log -25 --no-merges --pretty=format:"%h - %an, %ar : %s"
@dynnamitt
dynnamitt / JustWorks{4Me}Linux
Last active December 31, 2015 02:59
JustWorks{4Me}Linux
#!/bin/bash
# JustWorks{4Me}Linux --- version 0.0.1a
# each section is prepped for copy and paste
# mount /arch (freshly formatted)
# set some ENVs
# find you mirror here: https://www.archlinux.org/mirrorlist/
@dynnamitt
dynnamitt / steal_site alias
Last active August 29, 2015 14:11
rip a site via http
alias steal_site='wget --mirror --convert-links --adjust-extension --page-requisites --no-parent'
@dynnamitt
dynnamitt / inotify_delay_cmd
Last active August 29, 2015 14:11
Run CMD in an inotify loop, restarting inotifywait each time to ensure new dirs get hooked in. Runs on $PWD
#!/bin/sh
#function for yo .bashrc/.zshrc
inotify_delay_cmd() {
while true; do
inotifywait -r -e create -e delete -e modify --exclude '^\./\..+' .
"$@"
done
}
@dynnamitt
dynnamitt / squash.sh
Last active October 8, 2015 08:15
Git Pull PREPARE
# Switch to the master(or dev) branch and make sure you are up to date.
# Taken from http://makandracards.com/makandra/527-squash-several-git-commits-into-a-single-commit
# ===================================================================================================
# ------ basically ggpull 1st;
git checkout dev
git fetch upstream # eller `git fetch origin` HVIS gatekeeper
git merge upstream/dev # eller `git pull` HVIS gatekeeper
# start here ;
# bonus: sexy logfile ;)
sudo su
printf "#\!/usr/bin/env sh\n(date;docker rmi \$(docker images -q);echo +++++;) \
>> /var/log/docker_rmi_cron.log 2>&1\n" > /etc/cron.weekly/docker-rmi
chmod +x /etc/cron.weekly/docker-rmi
@dynnamitt
dynnamitt / gitlab-star-deep-clone.sh
Last active March 15, 2022 09:17
GITLAB ::: git-clone ALL favs into deep-nested dirs (( curl | jq | parallel ))
#!/bin/sh
# Make sure you have a PRIVATE_TOKEN in the file ~/.gitlab_token
GL_TOKEN=$(cat ~/.gitlab_token)
[ -z $GL_TOKEN ] && (printf "\n\nno token!\n\n\n";exit 1)
# USERID from username ARG1 on command-line
USER_NAME=${1:-kjetil.midtlie}
USERID=$(curl "https://gitlab.com/api/v4/users?private_token=$GL_TOKEN&username=$USER_NAME" | jq -r '.[0]|.id')
@dynnamitt
dynnamitt / lookup_events.sh
Created January 31, 2023 14:15
cloudtrail lookup on username
#!/bin/sh
# improved some of guide:
# https://aws.amazon.com/premiumsupport/knowledge-center/troubleshoot-iam-permission-errors/
usage() {
echo >&2 "Usage: $0 <name@company.no|user_id> [hours_back]"
exit 1
}