Skip to content

Instantly share code, notes, and snippets.

View vhoulbreque's full-sized avatar

Vincent Houlbrèque vhoulbreque

View GitHub Profile
@vhoulbreque
vhoulbreque / move-windows.py
Created December 26, 2019 21:09
Move windows from unplugged screens to main window.
#!/usr/bin/env python3
"""
Source: https://askubuntu.com/a/665899/640314
"""
import subprocess
# get the resolution of the screen (+0+0)
res = [
int(n) for n in [
s.split("+")[0].split("x")\
@vhoulbreque
vhoulbreque / git-rebase.md
Created May 7, 2019 12:27
git-rebase steps

As seen here:

$ (some_branch) git log
$ (some_branch) git rebase -i origin/master
@vhoulbreque
vhoulbreque / stackexchange-websites.json
Created March 4, 2019 10:19
Stackexchange list of websites
{
"urls": [
"genealogy.stackexchange.com",
"gardening.stackexchange.com",
"skeptics.stackexchange.com",
"gaming.stackexchange.com",
"joomla.stackexchange.com",
"politics.stackexchange.com",
"magento.stackexchange.com",
"interpersonal.stackexchange.com",
@vhoulbreque
vhoulbreque / disk_usage_postgre.sql
Last active August 1, 2018 15:55
Get the size of the tables that have a table schema of "table_schema_name"
SELECT *, pg_size_pretty(total_bytes) AS total
, pg_size_pretty(index_bytes) AS INDEX
, pg_size_pretty(toast_bytes) AS toast
, pg_size_pretty(table_bytes) AS TABLE
FROM (
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM (
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME
, c.reltuples AS row_estimate
, pg_total_relation_size(c.oid) AS total_bytes
, pg_indexes_size(c.oid) AS index_bytes
@vhoulbreque
vhoulbreque / fork-forced-sync.md
Last active August 1, 2018 14:38
fork forced sync
git remote add upstream https://[upstream guy's repo url]  
git fetch upstream  
git reset --hard upstream/master
@vhoulbreque
vhoulbreque / nteract-tricks.md
Last active March 30, 2021 14:44
Make conda environments visible in nteract

Nteract tricks

To add a conda environment to the list of environments:

$ source activate thisenv
(thisenv) $ pip install ipykernel
(thisenv) $ python -m ipykernel install --user --name thisenv