Skip to content

Instantly share code, notes, and snippets.

@stefansundin
stefansundin / ltu_username.user.js
Last active January 1, 2016 23:09
Old Greasemonkey/Tampermonkey script, but could be nice to have for people studying at Luleå University of Technology (LTU).
// ==UserScript==
// @name LTU Username
// @namespace https://gist.github.com/stefansundin/
// @homepage https://gist.github.com/stefansundin/8214929
// @downloadURL https://gist.github.com/stefansundin/8214929/raw/ltu_username.user.js
// @version 1.0
// @author Stefan Sundin
// @description Autofill username
// @include https://logon.pub.ltu.se/cgi-bin/logon.cgi
// @include https://fronter.com/ltu/
@stefansundin
stefansundin / 1.gvidcomments.png
Last active January 3, 2016 02:29
Blast from the past. This old Greasemonkey script displayed information about the comments your videos had in your Google Video Status pages, when Google Video was still alive and kicking. R.I.P. Google Video, the only reason people used it was because it didn't have a limit on the video length.
1.gvidcomments.png
@stefansundin
stefansundin / 1.namedays-preview.png
Last active January 3, 2021 08:47
Google Calendar week numbers and Swedish namedays. https://sites.google.com/site/gcalweeknumbers/
1.namedays-preview.png
@stefansundin
stefansundin / 1.SubRip_batch.md
Last active January 3, 2016 05:19
A patch I made for SubRip 1.50b4 that enables batch processing.

Patch for SubRip batch processing

Based on SubRip 1.50 Beta 4.

Improvements:

  • Batch support.
  • Always save in Unicode.
  • Remember previously used character matrix file (auto-load).
  • Checkbox for auto-running post-OCR correction.
  • Auto-select correct language in post-OCR dialog.
  • Remember the last used save directory.
@stefansundin
stefansundin / install-pre-commit.sh
Last active September 17, 2023 11:46
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@stefansundin
stefansundin / make-chrome-app.sh
Last active August 30, 2022 13:06
Create Chrome apps in Mac OS.
#!/bin/sh
# wget https://gist.githubusercontent.com/stefansundin/c89fd15bae5a58831790/raw/make-chrome-app.sh
# chmod +x make-chrome-app.sh
# ./make-chrome-app.sh
echo "Note that the app will run with a separate data dir and thus not have your regular extensions and settings."
echo
echo "What should the app be called?"
read name
echo
@stefansundin
stefansundin / git-bundle-hook.md
Last active February 1, 2024 06:42 — forked from 8bitDesigner/1.md
Git post-checkout and post-merge hooks to simplify bundling and other tasks.

Make bundleing and npm installing easy

These git hooks runs bundle or npm install automatically whenever you:

  • git checkout a new branch with a different Gemfile or package.json.
  • git pull a change to Gemfile or package.json.

How to install

  1. cd awesome_git_repo
@stefansundin
stefansundin / git-status-rec
Last active August 29, 2015 14:03
Execute `git status` recursively.
#!/bin/bash
# Executes `git status` in any git subdirectories you may have in your working directory.
# Install in a directory that's in your PATH, e.g. /usr/local/bin
# cd /usr/local/bin
# wget https://gist.githubusercontent.com/stefansundin/4dbd0c4cfb75ff44ff14/raw/git-status-rec
# chmod +x git-status-rec
# Then go to your project directory and type:
# git status-rec
for F in *; do
@stefansundin
stefansundin / install-pre-push.sh
Last active October 12, 2023 10:33
Git pre-push hook to prevent force pushing the master/main branch.
#!/bin/bash
# This script will install a Git pre-push hook that prevents force pushing the master/main branch.
# There are three variants that I have built:
# - pre-push: prevents force-pushing to master/main.
# - pre-push-2: prevents force-pushing to master/main depending on the remote (you need to edit the file!).
# - pre-push-3: prevents any type of pushing to master/main.
# Set the desired version like this before proceeding:
# FILE=pre-push
# Single repo installation:
@stefansundin
stefansundin / ruby-versions.sh
Last active October 29, 2018 01:16
Script that finds out the ruby versions used in subdirectories, to help you reclaim disk space.
#!/bin/bash
# cd src
# wget https://gist.githubusercontent.com/stefansundin/70400e8b6cb22f7ea7e0/raw/ruby-versions.sh
# chmod +x ruby-versions.sh
# ./ruby-versions.sh
for F in *; do
[[ ! -d "$F" ]] && continue
unset V