Skip to content

Instantly share code, notes, and snippets.

View not-much-io's full-sized avatar

Kristo Koert not-much-io

View GitHub Profile
id: eir
tasks:
- id: eir::lorebook_install
deps: ['assets::install']
task: |
export finder_root_param="$assets_out"
linker \
"$(finder death_record.ttf)" \
"links/fonts/death_record.ttf" \
"$(finder chalkboard.jpg)" \
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@not-much-io
not-much-io / cloudSettings
Last active November 28, 2018 09:47
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-11-28T09:47:00.421Z","extensionVersion":"v3.2.2"}
@spec new_grid(pos_int, pos_int) :: grid
def new_grid(height, width), do: new_grid(height, width, [])
@spec new_grid(pos_int, pos_int, [cell_state]) :: grid
defp new_grid(h, w, acc)
defp new_grid(0, _w, acc), do: acc
defp new_grid(h, w, acc), do: new_grid(h - 1, w, [new_grid_line(w) | acc])
@spec new_grid_line(pos_int, [cell_state]) :: [cell_state]
defp new_grid_line(width, acc \\ [])
from destructuring import destructure
from unittest import TestCase, main
from types import FunctionType
"""
This is just a proposition on how destructuring could be done in Python.
This is just an exercise, the result itself is not meant to be pragmatic for everyday Python code.
Unpacking is a limited form of destructuring:
a, b, c = [1, 2, 3]
;tl:dr
(defn start-scroll-interval []
; Uses (re-frame/dispatch [:set-auto-scroll-id interval-id])
..)
(defn stop-scroll-interval []
; Uses (re-frame/dispatch [:set-auto-scroll-id nil])
..)
from inspect import signature
from uuid import uuid1
# Just a proof of concept implementation of destructuring in python
def destructurable_params(fn, args):
"""Return a list of dicts that contain destructuring expressions and the parameters values.
Parameters with no valid destructuring syntax will be ignored.
:param fn: Function of interest
def get_tests(test_case_class):
"""Gets all tests from a TestCase class.
:param test_case_class: A subclass of TestCase
:return: tests in the TestCase
"""
test_case_instance = eval(test_case_class.__name__ + "()")
func_type = type(lambda x: None)
test_methods = []
import os
import urllib2
def check_in():
fqn = os.uname()[1]
ext_ip = urllib2.urlopen('http://whatismyip.org').read()
print ("Asset: %s " % fqn, "Checking in from IP#: %s " % ext_ip)
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import socket
from time import sleep
conf = dict(
# Any email address
toEmail='your_email@gmail.com',
# Google e-mail address