Skip to content

Instantly share code, notes, and snippets.

View olssonm's full-sized avatar
🖥️
Working on some cool stuff

Marcus Olsson olssonm

🖥️
Working on some cool stuff
View GitHub Profile
@olssonm
olssonm / allowPaste.js
Created September 21, 2018 13:20
Enable paste on sites that blocks it
var allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);
@olssonm
olssonm / composer.json
Created May 29, 2018 05:31
Load local packages via composer (for Laravel among others)
"require": {
"my/package": "dev-master",
},
"repositories": [
{
"type": "path",
"url": "../packages/my/package",
"options": {
"symlink": true
}
@olssonm
olssonm / git restore
Created January 26, 2018 07:24
Restore files to a previous state in git
# Via https://stackoverflow.com/questions/215718/reset-or-revert-a-specific-file-to-a-specific-revision-using-git
git checkout c5f567 -- file1/to/restore file2/to/restore
# ~1 denotes commits before hash
git checkout c5f567~1 -- file1/to/restore file2/to/restore
@olssonm
olssonm / newline.py
Created January 17, 2018 06:52
Fix for corrupted files in /var/lib/dpkg/info/ – every and all credit to this forum post: https://ubuntuforums.org/showthread.php?t=1319791
#!/usr/bin/python
# 8th November, 2009
# update manager failed, giving me the error:
# 'files list file for package 'xxx' is missing final newline' for every package.
# some Googling revealed that this problem was due to corrupt files(s) in /var/lib/dpkg/info/
# looping though those files revealed that some did not have a final new line
# this script will resolve that problem by appending a newline to all files that are missing it
# NOTE: you will need to run this script as root, e.g. sudo python newline_fixer.py
@olssonm
olssonm / sv-locale.sh
Last active December 4, 2022 17:58
Install Swedish language pack on Ubuntu
#Update package lists
sudo apt-get update
#Fetch language pack
sudo apt-get install language-pack-sv
#Check available languages, sv_SE.utf8
locale -a
#Generate locale
@olssonm
olssonm / macos-disable-resize
Last active April 18, 2024 14:26
Disable resizing of the macOS dock
defaults write com.apple.dock size-immutable -bool true; killall Dock
@olssonm
olssonm / site.conf
Created August 15, 2017 11:17
Nginx browser cache
# BROWSER CACHE
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|xml|otf|ttf|eot|woff|woff2|svg|ico)$ {
expires 365d;
}

Keybase proof

I hereby claim:

  • I am olssonm on github.
  • I am olssonm (https://keybase.io/olssonm) on keybase.
  • I have a public key ASCzC811GvJdvWmN0-mAQKbO6LG3DHz0paOzwnfef4rVfwo

To claim this, I am signing this object:

@olssonm
olssonm / homestead56.yaml
Created July 6, 2017 13:13
Laravel Homestead
---
ip: "192.168.10.20"
version: 0.3.3
memory: 2048
cpus: 1
hostname: homestead56
name: homestead56
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
@olssonm
olssonm / .bash_profile
Created June 22, 2017 07:18
Quick shortcut to copy your ssh key
function copykey() {
pbcopy < ~/.ssh/id_rsa.pub
echo "Key copied!"
}