Skip to content

Instantly share code, notes, and snippets.

View elehcim's full-sized avatar
🔭

Michele Mastropietro elehcim

🔭
View GitHub Profile
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@mwaskom
mwaskom / basic_tutorial.ipynb
Last active December 11, 2019 14:42
Copy of the new seaborn basic plots tutorial showing new functionality for forthcoming v0.9
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyberang3l
cyberang3l / How to setup VirtualGL and TurboVNC on Ubuntu.md
Last active February 5, 2025 12:42
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding
@wvengen
wvengen / NOTES.md
Last active March 13, 2021 17:20
Freedrum on Linux

Freedrum on Linux

The recently released Freedrum has no official Linux support. But, fortunately, it uses standard Bluetooth LE MIDI. It doesn't seem to work out of the box, yet (on Ubuntu 17.04, most probably Ubuntu 18.04 will support it directly).

Bluez 5.46

One really needs bluez 5.46 or higher. On Ubuntu, these are packaged in artful proposed (amd64). Unfortunately, MIDI support is not enabled in this build (Ubuntu bug #1713017).

So you'll need to download the sources, install dependencies plus libasound2-dev, build and install resulting debs. You may need to add --enable-midi to debian/rules. Like this:

@MarcoBuster
MarcoBuster / Stazioni italiane.csv
Last active March 23, 2023 12:51
Lista delle stazioni ferroviarie civili italiane, fruibile da ricerca e tabella .csv
code region long_name short_name latitude longitude
S01427 1 Ardenno Masino Ardenno Masino 46.16198 9.651374
S01947 1 Arena Po Arena Po 45.082065 9.360394
S01847 1 Asola Asola 45.220454 10.402313
S01041 1 Corbetta S. Stefano Corbetta S.Stef. 45.480829 8.917457
S01424 1 Cosio Traona Cosio Traona 46.135564 9.525498
S01207 1 Gazzada Schianno Morazzone Gazzada Schian.M 45.77862 8.824815
S02381 1 Gazzo Di Bigarello Gazzo Di Bigarel 45.176648 10.894005
S01841 1 Ghedi Ghedi 45.409439 10.280506
S02382 1 Castel D`Ario Castel D'Ario 45.183399 10.97531
@alexanderhupfer
alexanderhupfer / main.py
Last active November 15, 2019 10:50
Display logfile in realtime with bokeh
# Plot logtime in realtime using bokeh and tail -f
# Tested with python 3.5 and bokeh 0.12.4
# OSX/Linux only
# usage:
# 1. run 'bokeh serve'
# 2. run 'python3.5 main.py logfile.csv'
# assumes a logfile.csv with format:
# min_ask,1489758134.150000,1077.00,1076.78,0.45
# max_bid,1489758139.660000,1076.56,1076.76,0.41
# min_ask,1489758142.076000,1076.95,1076.76,0.40
@whizzzkid
whizzzkid / XPS-15 9560 Getting Nvidia To Work on KDE Neon
Last active December 3, 2022 15:43
[XPS 15 Early 2017 9560 kabylake] Making Nvidia Drivers + (CUDA 8 / CUDA 9 / CUDA 9.1) + Bumblebee work together on linux ( Ubuntu / KDE Neon / Linux Mint / debian )
# Instructions for 4.14 and cuda 9.1
# If upgrading from 4.13 and cuda 9.0
$ sudo apt-get purge --auto-remove libcud*
$ sudo apt-get purge --auto-remove cuda*
$ sudo apt-get purge --auto-remove nvidia*
# also remove the container directory direcotory at /usr/local/cuda-9.0/
# Important libs required with 4.14.x with Cuda 9.X
$ sudo apt install libelf1 libelf-dev
@gioper86
gioper86 / cassandra_to_pandas.py
Last active October 9, 2024 08:18
Get a Pandas DataFrame from a Cassandra query
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
import pandas as pd
def pandas_factory(colnames, rows):
return pd.DataFrame(rows, columns=colnames)
cluster = Cluster(
contact_points=['127.0.0.1'],
auth_provider = PlainTextAuthProvider(username='cassandra', password='cassandra')
#!/bin/sh
jq -r 'def banner: "\(.) " + (28-(.|length))*"-";
("Non-cell info" | banner), del(.cells), "",
(.cells[] | ("\(.cell_type) cell" | banner),
"\(.source|add)",
if ($show_output == "1") then
"",
( select(.cell_type=="code" and (.outputs|length)>0) |
("output" | banner),
(.outputs[] |
@jakevdp
jakevdp / discrete_cmap.py
Last active January 12, 2025 13:24
Small utility to create a discrete matplotlib colormap
# By Jake VanderPlas
# License: BSD-style
import matplotlib.pyplot as plt
import numpy as np
def discrete_cmap(N, base_cmap=None):
"""Create an N-bin discrete colormap from the specified input map"""