Skip to content

Instantly share code, notes, and snippets.

@fny
fny / GNU GPL Comment Headers.md
Last active November 22, 2024 23:00
GNU GPL formatted into a comment block and hard wrapped at 80 characters.

GNU GPL Comment Headers Formatted in Various Languages

A convenient reference for adding a GPL license to a work.

All prepared texts are hard wrapped at 80 characters unless stated otherwise.

No Wrap

@fny
fny / MIT License Comment Headers.md
Created March 3, 2018 17:38
MIT License Comment Headers

MIT License Comment Headers Formatted for Various Languages

A convenient reference for adding a MIT license to a work.

All prepared texts are hard wrapped at 80 characters unless stated otherwise.

No Wrap

@fny
fny / add_bookmark.jquery.js
Created February 25, 2012 04:21
Add Bookmark Script
/*!
* Copyright 2006-2011 Dynamic Site Solutions.
* Free use of this script is permitted for non-commercial applications,
* subject to the requirement that this comment block be kept and not be
* altered. The data and executable parts of the script may be changed
* as needed. Dynamic Site Solutions makes no warranty regarding fitness
* of use or correct function of the script. Terms for use of this script
* in commercial applications may be negotiated; for this, or for other
* questions, contact "license-info@dynamicsitesolutions.com".
*
# Get Sublime Text to use your rvm ruby without hardcoding a `$USER`.
#
# Include the configurations below the commend in the appropriate file listed below:
#
# - OS X ST2: ~/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.sublime-build
# - OS X ST3: ~/Library/Application Support/Sublime Text 3/Packages/User/Ruby.sublime-build
# - Linux ST2: ~/.config/sublime-text-2/Packages/Ruby/Ruby.sublime-build
# - Linux ST3: ~/.config/sublime-text-3/Packages/User/Ruby.sublime-build
{
@fny
fny / nfl-teams.json
Created July 11, 2016 17:58
NFL Teams JSON
[
{
"code": "ARI",
"name": "Cardinals",
"full_name": "Arizona Cardinals"
},
{
"code": "ATL",
"name": "Falcons",
"full_name": "Atlanta Falcons"
@fny
fny / GNU GPL.md
Created January 30, 2013 22:06
GNU General Public License in Markdown

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

@fny
fny / jupyter-resource-usage.py
Created August 11, 2022 14:21
Compute resource usage by Jupyter Notebooks at a given address (RAM and CPU)
import subprocess
import requests
import psutil
def get_notebooks(host, port, token = None):
sessions_url = f'http://{host}:{port}/api/sessions/?token={token}' if token else f'http://{host}:{port}/api/sessions'
response = requests.get(sessions_url).json()
notebooks = [{'kernel_id': notebook['kernel']['id'],
'path': notebook['notebook']['path']} for notebook in response]
@fny
fny / GNU LGPL Comment Headers.md
Last active May 18, 2022 07:00
GNU LGPL Comment Headers.md

GNU LGPL Comment Headers Formatted for Various Languages

A convenient reference for adding a LGPL license to a work.

All prepared texts are hard wrapped at 80 characters unless stated otherwise.

No Wrap

@fny
fny / list.md
Created January 28, 2022 01:40 — forked from ih2502mk/list.md
Quantopian Lectures Saved
@fny
fny / bash.sh
Created August 11, 2021 02:06
bash-snippets.sh
function concat_with_header() {
# Quoted suffix to pattern match for concatenation (e.g. '*.csv')
local suffix="${1}"
# Name of the output file
local output="${2:-combined.out}"
# Number of lines to use for the header
local header_length="${3:-1}"
# Grab the header from the first file
local header=`echo -e "$(ls -b *$suffix | head -n$header_length)"`
head -1 $header_file > $output; tail -n +"`expr $header_length + 1`" -q *$suffix >> $output