Skip to content

Instantly share code, notes, and snippets.

View BjornW's full-sized avatar

BjornW BjornW

View GitHub Profile
@BjornW
BjornW / gist:55c267e4ad436430d1eb6ff4a81dd472
Created May 16, 2018 15:56
Make Nautilus use list-view on Ubuntu 16.04 with i3wm as window manager
Type this into the terminal:
gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view'
@BjornW
BjornW / Howto-install-Arduino-1.8.5-on-Ubuntu-16.04LTS.md
Last active March 28, 2018 18:47
Install Arduino 1.8.5 on Ubuntu 16.04
  1. Download Arduino IDE from https://www.arduino.cc/download_handler.php
  2. Extract arduino-1.8.5-linux64.tar.xz
  3. Copy arduino-1.8.5 into /opt/arduino
  4. Go into /usr/local/bin, e.g. cd /us r/local/bin
  5. Make a symlink from /usr/local/bin/arduino to /opt/arduino/arduino-1.8.5/arduino, e.g. ln -s /opt/arduino/arduino-1.8.5/arduino arduino
@BjornW
BjornW / waarom-ssl-certificaat.md
Created December 18, 2017 21:36
Waarom een SSL certificaat

hier

@BjornW
BjornW / gist:a77903b00977c1e27d5dc29f50895036
Created December 15, 2017 10:03
Rewrite rules for WordPress Multisite (4.9.1) with Nginx used in BD
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}
## See also:
## https://easyengine.io/wordpress-nginx/tutorials/multisite/subdirectories/minimal/

After a bit of poking around svgo:

  1. in /usr/bin is a commandline node apps installed, which is more like a shell script calling node. E.g svgo
  2. libs used are installed in /usr/lib/node_modules, which are referenced from the svgo shell script
@BjornW
BjornW / howto-install-npm-ubuntu-16.04.md
Last active November 29, 2017 20:18
Install npm on Ubuntu 16.04

I'm installing the current LTS release of nodejs and npm, which is v8.9.1 and 5.5.1 on Ubuntu 16.04 LTS

  1. Download the setup script: https://deb.nodesource.com/setup_8.x and make sure you understand what it does before continuing...
  2. Chmod +x the setup script to make it an executable. Mine is called setup_8.x and I have renamed it setup_8.x.sh
  3. Run the script with sudo, it will add another repository to your sources.list.d and update apt's cache.
  4. Install the nodejs packages as the script states using: sudo apt-get install nodejs
  5. Type nodejs --version to get your nodejs version and type npm -v to get your npm version.

If all went well it should be similar to mine.

@BjornW
BjornW / replace-sudo-in-current-directory.sh
Last active November 28, 2017 10:15
One-liner to replace sudo in Ansible playbook roles with become
grep -irl 'sudo' . | xargs sed -i 's/sudo: yes/become: true/g'
@BjornW
BjornW / langoliers.rb
Created July 31, 2017 15:42 — forked from robinsloan/langoliers.rb
Tweet delete script
require "rubygems"
require "twitter"
require "json"
# things you must configure
TWITTER_USER = "your_username"
MAX_AGE_IN_DAYS = 1 # anything older than this is deleted
# get these from dev.twitter.com
CONSUMER_KEY = "your_consumer_key"
@BjornW
BjornW / test_array.php
Last active January 25, 2017 09:52
When using array's with a switch make sure alle keys in the array are strings or else you'll get weird issues. I'd rather have PHP give me an error instead of casting!?
<?php
// Weird things can happen with an array having both strings and integers as
// keys...
// First we create a test array with only strings as keys
$strings_array = array( 'foo' => 1, 'bar' => 2);
// Second, using the strings array we create a new array and add a key with an integer zero
$strings_and_int_array = $strings_array;
$strings_and_int_array[0] = 666;
@BjornW
BjornW / remove_ds_store_crap.sh
Created May 20, 2016 12:18
Remove .DS_Store from directory
find $DIR -name ".DS_Store" -print0 | xargs -0 rm -r