Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
lambdamusic / bard-input-test.md
Last active November 28, 2023 20:24
bard input test
@lambdamusic
lambdamusic / 2023-07-04-notes-deep-work-the-book.md
Last active November 22, 2023 08:50
notes-deep-work-2016

Notes from Deep Work by Cal Newport

A very biased collection of quotes and ideas from the book Deep Work by Cal Newport (2016).

Concept map

flowchart LR
    A((Deep Work)) -->|Versus| B(Shallow Work)
    B --> B1[Shallow work promotes more shallow work]
@lambdamusic
lambdamusic / gist-backup.py
Last active July 27, 2023 14:28 — forked from fedir/gist-backup.py
Clone or update all user's gists #gists
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Forked from https://gist.github.com/fedir/5466075
Changes:
- allows to import Github gists into a local DASH database (https://kapeli.com/dash)
- gists are added to any existing snippet already in database
- filetypes are added, but support is very basic
@lambdamusic
lambdamusic / Snipplr-56709.py
Created February 7, 2013 21:28
Python: RGB Color Gradation Function
import string
def make_color_tuple( color ):
"""
turn something like "#000000" into 0,0,0
or "#FFFFFF into "255,255,255"
"""
R = color[1:3]
G = color[3:5]
B = color[5:7]
@lambdamusic
lambdamusic / define.py
Last active February 15, 2023 14:52
Access osx dictionary in python
#!/usr/bin/env python
"""
# Version
2021-08-31
# Tested on
Python 3.9
@lambdamusic
lambdamusic / quote.md
Last active January 23, 2023 08:05
test-quote

template: quote.html title: "Additive manufacturing" source: "A Third Industrial Revolution | The Economist" url: http://www.economist.com/node/21552901 date: 2013-02-26 modified: 2015-05-04 review: false

@lambdamusic
lambdamusic / Snipplr-50835.py
Created February 7, 2013 21:28
Django: Strip/Remove HTML tags (django utils)
# To strip/remove HTML tags from an existing string we can use the strip_tags function.
# import the strip_tags
from django.utils.html import strip_tags
# simple string with html inside.
html = '<p>paragraph</p>'
print html # will produce: <p>paragraph</p>
stripped = strip_tags(html)
@lambdamusic
lambdamusic / generate_noise.py
Created March 10, 2013 17:01
Python: generate audio noise
# from http://soledadpenades.com/2009/10/29/fastest-way-to-generate-wav-files-in-python-using-the-wave-module/
import wave
import random
import struct
import datetime
SAMPLE_LEN = 44100 * 300 # 300 seconds of noise, 5 minutes
print "Create file using wave and writeframes twice in each iteration"
@lambdamusic
lambdamusic / wdatebash
Last active October 12, 2021 10:00
World date from the terminal
#!/bin/bash
wdate () {
search=$1;
zoneinfo=/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pytz/zoneinfo/;
format='%a %F %T';
find -L $zoneinfo -type f \
@lambdamusic
lambdamusic / python_request_create_gist.py
Last active April 11, 2021 20:19 — forked from joshisumit/python_request_create_gist.py
Create GIST from your python code with python requests module and OAuth token.
'''
HTTP Reuests has following parameters:
1)Request URL
2)Header Fields
3)Parameter
4)Request body
PREREQUISITE
* head over to https://github.com/settings/tokens and generate a new token with 'gists' permissions