Skip to content

Instantly share code, notes, and snippets.

View luispabon's full-sized avatar

Luis Pabon luispabon

  • Auron Consulting Ltd
  • London
View GitHub Profile
@luispabon
luispabon / run-docker-npm
Last active June 29, 2016 15:05
npm install / build using a docker container
#!/usr/bin/env bash
# The following runs latest node container providing with a writable .npm folder for npm cache, node_modules will be owned by the running user
# usage: run-docker-npm npm install
mkdir -p .npm
touch .babel.json
docker run \
-u $(id -u):$(id -g) \
-v "`pwd`:/workdir" \
-v "`pwd`/.npm:/.npm" \
-v "`pwd`/.babel.json:/.babel.json" \
@luispabon
luispabon / gist:d8f878acac630166ec564c8cf9ec1c98
Created July 13, 2016 16:50
Pirate bay apache reverse proxy
# Basic reverse proxy, no SSL (useful in Kodi)
# You need to install modules proxy, proxy_http, ssl
<VirtualHost *:80>
ServerName your.address
ProxyPreserveHost Off
ProxyRequests Off
ProxyTimeout 60
SSLProxyEngine on
@luispabon
luispabon / phpunit.sh
Created February 8, 2018 11:23
phpunit runner: first your projects, fall back to phar
#!/bin/bash
###
# Copyright (C) 2018 Luis Pabon
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
###
# This script will try to run first phpunit installed in your project (assumes standard vendor bin location, modify if otherwise)
# then fall back to a phar installed version.
# Usage: create and chmod +x an empty file somewhere in your path (eg ~/bin/phpunit) then tweak PHPUNIT_PHAR below for your system.
@luispabon
luispabon / borg-backup.sh
Last active February 16, 2018 06:09
Encrypted borg backup to s3 of home folder
#!/bin/bash
# NOTE: decided to actually make a more reusable version with README and all, to be found at
# this repo: https://github.com/luispabon/borg-s3-home-backup
@luispabon
luispabon / unity-post-install.sh
Last active June 25, 2018 19:10
Unity Ubuntu Bionic post install
#!/bin/bash
# I recommend you first install ubuntu-unity-desktop, do not clean off apt cache, then sudo apt autoremove --purge "gnome*"
# then install again ubuntu-unity-desktop without rebooting once and with a network connection. This gets rid of Gnome
# entirely except for what unity needs to function
# Run this if the background image on the login greeter for your user doesn't change as you change desktop backgrounds
gsettings org.gnome.settings-daemon.plugins.background active true
# This will install a patched version of nemo without cinnamon deps, then make it the default
@luispabon
luispabon / README.md
Created September 9, 2018 13:35
Brother DCP-7055 scanner on ubuntu bionic 18.04

DCP-7055 scanner (brscan4) fix

The printer has always worked in Ubuntu out of the box.

The old driver page at the Brother website contains drivers that won't work on Bionic no longer though. You need to use a newer version provided here: http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128

The old page has the 0.4.2 version of the driver, but Bionic needs 0.4.5 dated May 2018 on that page above. Best to use the installer script at the top of that page (it will add a second printer you can delete, but fixes the scanner).

##################################################
# Fancy PWD display function
##################################################
# The home directory (HOME) is replaced with a ~
# The last pwdmaxlen characters of the PWD are displayed
# Leading partial directory names are striped off
# /home/me/stuff -> ~/stuff if USER=me
# /usr/share/big_dir_name -> ../share/big_dir_name if pwdmaxlen=20
##################################################
bash_prompt_command() {
@luispabon
luispabon / lockscreen.log
Created June 26, 2019 09:11
swaylock crash on suspend
2019-06-19 17:37:38 - [sway/input/switch.c:38] 0:5:Lid_Switch: type 1 state 1
2019-06-19 17:37:38 - [types/wlr_surface.c:609] New wlr_surface 0x56004c58bb40 (res 0x56004c3c7c20)
2019-06-19 17:37:38 - [types/wlr_surface.c:609] New wlr_surface 0x56004c5b7120 (res 0x56004c1e9ab0)
2019-06-19 17:37:38 - [types/wlr_layer_shell_v1.c:388] new layer_surface 0x56004c682ad0 (res 0x56004c3d3e90)
2019-06-19 17:37:38 - [sway/desktop/layer_shell.c:368] new layer surface: namespace lockscreen layer 3 anchor 3 size 0x0 margin 0,0,0,0
2019-06-19 17:37:38 - [sway/desktop/layer_shell.c:314] Layer surface destroyed (lockscreen)
Segmentation fault (core dumped)
2019-06-19 17:37:38 - [sway/tree/arrange.c:190] Usable area for ws: 1920x1045@0,35
2019-06-19 17:37:38 - [sway/tree/arrange.c:221] Arranging workspace '3' at 0.000000, 35.000000
2019-06-19 17:37:38 - [sway/desktop/transaction.c:412] Transaction 0x56004c4e6360 committing with 4 instructions
@luispabon
luispabon / backtrace
Last active July 2, 2019 14:12
swaylock segfault
bt full
#0 0x00007ff1f521ec00 in xkb_state_layout_index_is_active ()
from /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0
No symbol table info available.
#1 0x00005605eaa7890d in keyboard_modifiers ()
No symbol table info available.
#2 0x00007ff1f43f181e in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
No symbol table info available.
#3 0x00007ff1f43f11ef in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
No symbol table info available.
@luispabon
luispabon / apps-bin-path.sh
Created May 14, 2019 10:03
Snap app support in shell
# shellcheck shell=sh
# Expand $PATH to include the directory where snappy applications go.
snap_bin_path="/snap/bin"
if [ -n "${PATH##*${snap_bin_path}}" -a -n "${PATH##*${snap_bin_path}:*}" ]; then
export PATH=$PATH:${snap_bin_path}
fi
# Ensure base distro defaults xdg path are set if nothing filed up some
# defaults yet.