Skip to content

Instantly share code, notes, and snippets.

@adrn
adrn / Make-all-Hessians.ipynb
Created October 15, 2020 01:45
projects/gala-notebooks/Make-all-Hessians.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adrn
adrn / Kinesis-model.ipynb
Created July 25, 2019 17:25
dr2-lmc-cluster/notebooks/Kinesis-model.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@sundowndev
sundowndev / GoogleDorking.md
Last active June 1, 2024 08:41
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
@iamaaditya
iamaaditya / jupyterlab_clear_output.json
Last active February 24, 2021 14:51
JupyterLab Keyboard Shortcut Clear Output
{
"notebook:hide-cell-ouputs": {
"keys": [
"L"
],
"command": "notebook:hide-cell-ouputs",
"selector": ".jp-Notebook:focus",
}
"notebook:show-cell-ouputs": {
"keys": [
@jobovy
jobovy / SimpleBarModel.ipynb
Created January 4, 2017 19:51
A very simple bar model for the Milky Way in galpy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aiguofer
aiguofer / README.md
Last active April 27, 2023 19:12
Get info about running jupyter notebooks including memory consumption, how long they've been running, etc.
class BayesianModel(object):
samples = 2000
def __init__(self, cache_model=True):
self.cached_model = None
self.cached_start = None
self.cached_sampler = None
self.shared_vars = {}
def cache_model(self, **inputs):
self.shared_vars = self._create_shared_vars(**inputs)
@jakevdp
jakevdp / discrete_cmap.py
Last active May 29, 2024 18:50
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"""
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active May 8, 2024 05:28
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost