Skip to content

Instantly share code, notes, and snippets.

import pandas as pd
import treasury_gov_pandas
from bokeh.plotting import figure, show
from bokeh.models import NumeralTickFormatter, HoverTool
import bokeh.models
import bokeh.palettes
import bokeh.transform
# ----------------------------------------------------------------------
df = treasury_gov_pandas.update_records(
@psu
psu / logseq-config-default-queries.edn
Last active May 2, 2024 17:02
logseq-config-default-queries.edn
;; Logseq Default Query 6-pack
;; ---------------------------
;;
;; Pontus Sundén (@psu)
;; October 28, 2022
;;
;; Attribution
;; - https://gist.github.com/sawhney17/3a1b04936f35df80253431a61cb74737
;;
;; ---------------------------
@swyxio
swyxio / adaptive_intent.md
Created May 3, 2019 08:04
an adaptive, intent based CLI "state machine"

an adaptive, intent based CLI "state machine"

one realization from working on Netlify's CLI is that the CLI framework we used, oclif, didn't provide a great user experience out of the box.

Emphasis on great: it does a lot of nice things, like offering flag and argument parsing, help documentation, and pluggability. That's good for the CLI developer. But what about the CLI user?

  • Idiomatic oclif code often checks for required preconditions, and if it doesn't exist, it prints a warning and then process.exit(1).
  • Decent code prints a helpful warning telling the user what they got wrong. It is informative.
  • Better code offers a prompt, creates a file, or something similar to solve the precondition before proceeding. (possibly recursively). It is intent-based.
  • Great code remembers past inputs to prompts and uses that to offer useful defaults. It is adaptive.
@shamil
shamil / mount_qcow2.md
Last active May 3, 2024 06:35
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@chehab
chehab / dumy-page.html
Created July 28, 2013 16:39
nav-tree ( Bootstrap 3 + Font Awesome )
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title> nav-tree &mdash; Bootstrap3 + Font Awesome </title>
@xem
xem / LICENSE.txt
Last active October 29, 2022 09:55 — forked from 140bytes/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@anantn
anantn / firebase_create.js
Last active November 20, 2023 23:17
Firebase: Creating data if it doesn't exist. This snippet creates a user only if it doesn't already exist.
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
@lefnire
lefnire / gist:4026626
Created November 6, 2012 18:40
Derby Community Info (Workflowy Export)
Derby Community Info
- Projects
- Codeparty (Brian & Nate)
"https://github.com/codeparty"
- Derby
"https://github.com/codeparty/derby"
- Derby Examples
"https://github.com/codeparty/derby-examples"
- Racer
@mhdhejazi
mhdhejazi / CopyAsanaTasks.php
Created October 24, 2012 16:43
Copy/Move project to a new workspace in Asana
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@meleyal
meleyal / jquery.draghover.js
Created September 27, 2012 13:52
jquery.draghover.js
/*
jquery.draghover.js
Emulates draghover event by tracking
dragenter / dragleave events of element + children.
https://gist.github.com/gists/3794126
http://stackoverflow.com/a/10310815/4196