Skip to content

Instantly share code, notes, and snippets.

View mandx's full-sized avatar

Armando Pérez Marqués mandx

View GitHub Profile
@mandx
mandx / nosnap-firefox.pref
Created May 16, 2022 03:53
Reduce the priority of the `firefox` package that installs the snap version
# /etc/apt/preferences.d/nosnap-firefox.pref
Package: firefox
Pin: release o=Ubuntu
Pin-Priority: -10
@mandx
mandx / install-pyls.sh
Created May 21, 2020 04:52
Install everything PyLS (Python Language Server) related
pip install 'python-language-server[flake8,mccabe,pycodestyle,pydocstyle,pyflakes,pylint,rope]' pyls-mypy pyls-black django-stubs djangorestframework-stubs
@mandx
mandx / clean_chrome.py
Created July 21, 2017 21:41
Simple Python 3 script to launch a new, clean Chrome instance
from subprocess import run
from tempfile import TemporaryDirectory
if __name__ == '__main__':
with TemporaryDirectory() as tempdir:
run([
'google-chrome',
'--user-data-dir==' + tempdir,
'--incognito',
# From https://github.com/yarnpkg/yarn/issues/1776#issuecomment-269539948
# The approach that has worked for me so far is this:
git rebase origin/master
# When the first conflict arises, I checkout the yarn.lock then re-perform the installation
git checkout origin/master -- yarn.lock
yarn install
@mandx
mandx / cloud-image-region-transfer.sh
Created July 15, 2015 16:34
Script to copy a Rackspace server image from one data center (region) to another (by Andrew Howard)
#!/bin/bash
#
# Author: Andrew Howard
# This script will copy an server image from one region to another.
# BE AWARE: This will incur charges for the customer. These charges
# can be minimized by using ServiceNet for the download and by choosing
# to auto-delete the Cloud Files content once the transfer is complete.
# Even with these precautions, the customer will be charged for storage
# fees in Cloud Files (for a single month) and Cloud Images (destination).
# Note: To use ServiceNet, this script MUST be run on a Cloud Server
start on startup
setuid itslocal
exec /path/to/the/python-lib/or/virtualenv/bin/sentry --config=/path/to/my/sentry.conf.py start
@mandx
mandx / fields.py
Created December 7, 2012 20:53
Some Django fields enhancements
# -*- coding: utf-8 -*-
"""
Some custom field types
"""
import re
from django.conf import settings
from django.db import models
@mandx
mandx / dabblet.css
Created April 21, 2012 22:17
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;