Skip to content

Instantly share code, notes, and snippets.

View snichme's full-sized avatar

Magnus Landerblom snichme

View GitHub Profile
@snichme
snichme / prom_parser.cr
Created June 22, 2023 07:00
Parse Prometheus in Crystal
require "json"
HASH = 35
NEWLINE = 10
SPACE = 32
CURLY_BRACKET_LEFT = 123
CURLY_BRACKET_RIGHT = 125
EQUALSIGN = 61
BACKSLASH = 92
QUOTE = 34
@snichme
snichme / starship.toml
Created January 27, 2021 23:00
Starship config
add_newline = false
format = """[$directory]()\
$git_branch$git_commit$git_state$git_status$status$character"""
[directory]
# truncate_to_repo = false
# truncation_length = 8
fish_style_pwd_dir_length = 1
#include <stdio.h>
main(t,_,a)char *a;{return!0<t?t<3?main(-79,-13,a+main(-87,1-_,
main(-86,0,a+1)+a)):1,t<_?main(t+1,_,a):3,main(-94,-27+t,a)&&t==2?_<13?
main(2,_+1,"%s %d %d\n"):9:16:t<0?t<-72?main(_,t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+,/+#n+,/#\
;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l \
q#'+d'K#!/+k#;q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# \
){nl]!/n{n#'; r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' \
iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c \
;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;#'rdq#w! nr'/ ') }+}{rl#'{n' ')# \
#!/usr/bin/perl -w
use strict;
use IO::Socket::INET;
use IO::Socket::SSL;
use Getopt::Long;
use Config;
$SIG{'PIPE'} = 'IGNORE'; #Ignore broken pipe errors
print <<EOTEXT;
v=0000;eval$s=%q~d=%!^Lcf<LK8, _@7gj*LJ=c5nM)Tp1g0%Xv.,S[<>YoP
4ZojjV)O>qIH1/n[|2yE[>:ieC "%.#% :::##" 97N-A&Kj_K_><wS5rtWk@*a+Y5
yH?b[F^e7C/56j|pmRe+:)B "##% ::##########" O98(Zh)'Iof*nm.,$C5Nyt=
PPu01Avw^<IiQ=5$'D-y? "##: ###############" g6`YT+qLw9k^ch|K'),tc
6ygIL8xI#LNz3v}T=4W "# #. .####:#######" lL27FZ0ij)7TQCI)P7u
}RT5-iJbbG5P-DHB<. " ##### # :############" R,YvZ_rnv6ky-G+4U'
$*are@b4U351Q-ug5 " #######################" 00x8RR%`Om7VDp4M5
PFixrPvl&<p[]1IJ " ############:#### %#####" EGgDt8Lm#;bc4zS^
y]0`_PstfUxOC(q " .#############:##% .## ." /,}.YOIFj(k&q_V
zcaAi?]^lCVYp!; " %% .################. #. " ;s="v=%04o;ev"%
04c15929a86d1a0c4b611a8027cc03e9b9bc041ad36878570836eb99197670c57e6057729b7f51985b3321b6dafa81901e6e5ac54f452c25cb2cf5ea57dec9e846
(ns chestnut-app.core
(:require [om.next :as om :include-macros true]
[om.dom :as dom :include-macros true]
[compassus.core :as c]
[pushy.core :as pushy]
[goog.dom :as gdom]
[chestnut-app.ui :as ui]
[chestnut-app.parser :refer [read mutate]]
[chestnut-app.util :refer [transit-post]]
[chestnut-app.router :as router]))
(ns om-tutorial.mini
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]))
(enable-console-print!)
(def init-data
{:cards [{:id 1 :title "Title 1"}
{:id 2 :title "Title 2"}
@snichme
snichme / di.js
Created October 14, 2015 18:48
Dependency Injection in JavaScript
var di = (function Dein() {
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
var _register = {};
function anno(fn, strictDi, name) {
var fnText, argDecl, args;
@snichme
snichme / models.js
Created November 5, 2014 21:04
JS model with mixins
(function() {
'use strict';
/** Helper methods */
function merge(obj1, obj2) {
Object.keys(obj2).forEach(function(key) {
obj1[key] = obj2[key];
});
return obj1;
}