Skip to content

Instantly share code, notes, and snippets.

View xgarrido's full-sized avatar

Xavier Garrido xgarrido

View GitHub Profile
# MIT LICENSE
import datetime
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import numpy as np
import dash_core_components as dcc
import dash_html_components as html
import dash

VirtualData cheatsheet

Pre-requisites

Before starting, each user needs to open an account on the cloud: https://registration.lal.in2p3.fr/register. In addition, you would need Python 3.5+ installed on your computer.

Install the component clients

Openstack is a cloud computing platform, containing many components that offer different services. Let's cite Nova for the compute, Cinder for the block storage, Keystone to manage identity, or Glance for image. All components can be found at https://en.wikipedia.org/wiki/OpenStack#Components. For our purpose, we need to install a few of them

@rumansaleem
rumansaleem / clean-up-arch-linux.md
Created May 28, 2019 08:51
Instructions to clean up Arch Linux (Manjaro)

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • remove old config files
  • Find and Remove
    • duplicates
    • empty files
    • empty directories
  • broken symlinks
@dfm
dfm / betterstep.py
Last active March 1, 2023 18:49
A 'better' step function for matplotlib
import matplotlib.pyplot as plt
def betterstep(bins, y, **kwargs):
"""A 'better' version of matplotlib's step function
Given a set of bin edges and bin heights, this plots the thing
that I wish matplotlib's ``step`` command plotted. All extra
arguments are passed directly to matplotlib's ``plot`` command.
Args:
@mwaskom
mwaskom / seaborn_dark_background.ipynb
Created December 3, 2015 19:49
Use seaborn with a dark background, if you like that sort of thing.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@krishnakummar
krishnakummar / donut-example.py
Created September 11, 2015 11:56
Donut chart using python matplotlib
import matplotlib.pyplot as plt
# The slices will be ordered and plotted counter-clockwise.
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
colors = ['yellowgreen', 'gold', 'lightskyblue', 'lightcoral']
explode = (0, 0, 0, 0) # explode a slice if required
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True)
@grantslatton
grantslatton / hngen.py
Last active September 27, 2021 11:07
A program that uses Markov chains to generate probabilistic Hacker News titles.
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"
@whalliburton
whalliburton / ssh-keys.el
Created July 10, 2013 16:47
While keeping long standing emacs sessions on remote machines nside terminal multiplexers such as 'screen' and 'tmux', the SSH_AUTH_SOCK environment variable of the emacs process becomes stale after disconnection and reconnection. The interactive function SET-SSH-AGENT-SOCKET below allows for a quick and dirty way to automatically reset this var…
;; ssh-keys.el
;; While keeping long standing emacs sessions on remote machines
;; inside terminal multiplexers such as 'screen' and 'tmux', the
;; SSH_AUTH_SOCK environment variable of the emacs process becomes
;; stale after disconnection and reconnection. The interactive
;; function SET-SSH-AGENT-SOCKET below allows for a quick and dirty
;; way to automatically reset this variable to the latest incoming SSH
;; agent authorization socket.
@RhysU
RhysU / gist:5281465
Last active March 18, 2021 11:35
Using Boost Spirit 2.1+ to evaluate constant arithmetic expressions. See http://agentzlerich.blogspot.com/2011/06/using-boost-spirit-21-to-evaluate.html
//--------------------------------------------------------------------------
//
// Copyright (C) 2011, 2012, 2013 Rhys Ulerich
// Copyright (C) 2012, 2013 The PECOS Development Team
// Please see http://pecos.ices.utexas.edu for more information on PECOS.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
@klange
klange / _.md
Last active May 23, 2024 13:45
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le