Make sure you are subscribed to “Cloud Infrastructure” in CERN services: https://resources.web.cern.ch/resources/Manage/ListServices.aspx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See https://www.anaconda.com/understanding-and-improving-condas-performance/ for more info. | |
# help debug channel issues | |
show_channel_urls: true | |
# pip will always be installed with python | |
add_pip_as_python_dependency: true | |
# strict priority and conda-forge at the top will ensure | |
# that all of your packages will be from conda-forge unless they only exist on defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shelve | |
import string | |
import time | |
class MeasurementDB(object): | |
r"""Database for storing measurements, with export to LaTeX macros. | |
Example usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
# requires a recent enough python with idna support in socket | |
# pyopenssl, cryptography and idna | |
from OpenSSL import SSL | |
from cryptography import x509 | |
from cryptography.x509.oid import NameOID | |
import idna | |
from socket import socket |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name of the delta mass variable in the workspace | |
dmass_var = 'Dst_delta_M' | |
# Species of the PDF we're about to build | |
species = 'sig' | |
workspace.factory('mu_dm_{0}[141, 146]'.format(species)) | |
workspace.factory('sigma_one_dm_{0}[1, 0, 5]'.format(species)) | |
workspace.factory('nsigma_two_dm_{0}[1.5, 1, 3]'.format(species)) | |
workspace.factory('nsigma_three_dm_{0}[1.5, 1, 3]'.format(species)) | |
workspace.factory(( | |
'expr::sigma_two_dm_{0}(' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assume you have a git repo that contains some code | |
# you would like to use the same repo to create snapshots | |
# of how exactly the repo looked at certain moments in | |
# time. For example every time you run `amazing_script.py` | |
# You want to capture all the things, not just files already | |
# part of the repo, you don't care about conflicts, just | |
# take a picture of the directory as it was right at that | |
# moment. | |
# | |
# Is this a good way of doing this? |
This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.
To use the script, follow the instructions given in the script's docstring.
For further details, read this blogpost.
The procedure outlined here is inspired by this answer on Stack Overflow.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Keeps a tunnel to 'remote.example.com' open | |
After=network.target | |
[Service] | |
User=autossh | |
# -p [PORT] | |
# -l [user] | |
# -M 0 --> no monitoring | |
# -N Just open the connection and do nothing (not interactive) |
NewerOlder