Skip to content

Instantly share code, notes, and snippets.

@lvm
lvm / plasma.py
Created January 27, 2024 04:39
plain text plasma p/raspi w/3.5 screen
import math
import time
s = math.sin
q = math.sqrt
i = lambda a, b, c: a in range(b, c)
def c(x, y):
# http://www.purplemath.com/modules/distform.htm
t = time.time() * 1000 / 74
@lvm
lvm / README.md
Created February 13, 2017 16:37
[WIP] hackish emacs mode for FoxDot

Installation

  1. put foxdot-cli.py in the same directory as the FoxDot installaton (in case you're using virtualenv, otherwise comment from lines 5 to 7)
  2. copy foxdot-mode.el to ~/.emacs.d/lisp
  3. add (defvar foxdot-cli-path "/path/to/foxdot-cli/") in your ~/.emacs file
  4. in Emacs M-x load-library and complete with foxdot-mode
  5. Type C-c C-f or M-x foxdot-start to start
  6. Type C-c C-e or M-x foxdot-execute to evaluate a line or a block of code
@lvm
lvm / i3conf
Last active February 14, 2021 04:18
~/.i3/config + ~/.i3status.conf
# font
font pango:Ubuntu Mono Regular 12
# settings
set $mod Mod4
set $ws workspace
set $laptop LVDS1
set $launcher dmenu_run -i -nb '#393939' -nf '#48B685' -sb '#dfefe2' -sf '#393939'
# colors
;; mkdir -p $HOME/.emacs.d/themes \
;; && mkdir -p $HOME/.emacs.d/lisp \
;; && wget https://raw.githubusercontent.com/lvm/monochrome-theme.el/master/monochrome-transparent-theme.el -O $HOME/.emacs.d/themes/monochrome-transparent-theme.el
(require 'package)
(custom-set-variables
'(package-archives
(quote
(("gnu" . "http://elpa.gnu.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")))))
@lvm
lvm / flatten.py
Created August 28, 2020 05:03
Flat nested dicts.
def flatten(dct: dict, , prefix="", glue: str = "__") -> dict:
flat = {}
prefix = f"{prefix}{glue}" if prefix else ""
def _flat(dct):
_dct = {}
for k, v in dct.items():
if not isinstance(v, list) and not isinstance(v, dict):
_dct[k] = v
@lvm
lvm / youtube-mp3
Last active August 19, 2020 22:54
#!/usr/bin/env python3
import re
import eyed3
import shlex
import string
import argparse
import youtube_dl
import subprocess as sp
from pathlib import Path
@lvm
lvm / youtube-slice
Last active August 18, 2020 01:23
youtube-dl a portion of a video.
#!/usr/bin/env python3
import shlex
import argparse
import youtube_dl
import subprocess as sp
from pathlib import Path
from youtube_dl.utils import sanitize_filename
@lvm
lvm / admin.py
Created February 11, 2020 22:04 — forked from mariocesar/admin.py
Django admin decorator to create a confirmation form action, like the default delete action works
from .models import Post, Category
from .decorators import action_form
class PostCategoryForm(forms.Form):
title = 'Update category for the selected posts'
category = forms.ModelChoiceField(queryset=Category.objects.all())
@admin.register(Post)
@lvm
lvm / TidalReceiver.js
Last active September 5, 2019 06:06
Unity + TidalCycles
//https://github.com/heaversm/unity-osc-receiver
public var RemoteIP : String = "127.0.0.1";
public var SendToPort : int = 9000;
public var ListenerPort : int = 8000;
public var cubeReceivers: GameObject[];
public var sphereReceivers: GameObject[];
private var handler : Osc;
private var cyRot : int = 0;
@lvm
lvm / ddupe
Created September 2, 2019 14:02
find dupe directories, only 1 level.
#!/usr/bin/env python3
import argparse
from pathlib import Path
def get_dirs(path):
return dict([(x.name,x.as_posix())
for x in path.iterdir()
if x.is_dir()])