Skip to content

Instantly share code, notes, and snippets.

Avatar

Vincent Houlbrèque vinzeebreak

View GitHub Profile
@vinzeebreak
vinzeebreak / nteract-tricks.md
Last active Mar 30, 2021
Make conda environments visible in nteract
View nteract-tricks.md

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
@vinzeebreak
vinzeebreak / move-windows.py
Created Dec 26, 2019
Move windows from unplugged screens to main window.
View move-windows.py
#!/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")\
View git-rebase.md

As seen here:

$ (some_branch) git log
$ (some_branch) git rebase -i origin/master
@vinzeebreak
vinzeebreak / stackexchange-websites.json
Created Mar 4, 2019
Stackexchange list of websites
View stackexchange-websites.json
{
"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",
@vinzeebreak
vinzeebreak / disk_usage_postgre.sql
Last active Aug 1, 2018
Get the size of the tables that have a table schema of "table_schema_name"
View disk_usage_postgre.sql
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
View fork-forced-sync.md
git remote add upstream https://[upstream guy's repo url]  
git fetch upstream  
git reset --hard upstream/master