Skip to content

Instantly share code, notes, and snippets.

# example action
action = {
"id": "",
"buy": {"amount": "", "currency": ""},
"sell": {"amount": "", "currency": ""},
"state": "",
}
# alternate implementation: Pydantic or dataclasses
@DavidVujic
DavidVujic / editor.py
Created October 4, 2022 13:21
Python script that will print out a command, that will start your favorite code editor with environment variables & in an aws-vault context
"""Print out a shell command to start your favorite editor,
prepared with environment variables and in an aws-vault context.
Setup
put the editor.py and the .env file(s) somewhere outside of the repo folders.
Usage
Run the script with 3 parameters:
path to .env file
aws-vault profile
@DavidVujic
DavidVujic / simple_component_driven_cljs.cljs
Created December 23, 2021 08:53
Simple Component Driven ClojureScript examples
;; The shadow-cljs EDN configuration
{:source-paths
["src/main"]
:dependencies
[[reagent "1.1.0"]
[arttuka/reagent-material-ui "5.2.4-0"]]
:dev-http {8080 "public"}
@DavidVujic
DavidVujic / processData.js
Last active December 26, 2019 11:38
Node.js 12 blocking the event loop
function log(...args) {
console.log(Date.now().toString(), ...args);
}
function processData() {
log('processing ...');
for (let i = 0; i < 1000000; i += 1) {
JSON.parse('{"hello": "world"}');
}
@DavidVujic
DavidVujic / lodashquicksearch.sh
Created November 18, 2015 06:56
Lodash quick search
#!/bin/bash
(firefox -new-tab http://devdocs.io/lodash/index#"$1" &)
@DavidVujic
DavidVujic / gist:03b4fbb1dce80ee76b7f
Created June 11, 2015 10:53
_tics.js implementation example
<!DOCTYPE html>
<html>
<head>
<title>an example</title>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');