Skip to content

Instantly share code, notes, and snippets.

View scalp42's full-sized avatar
🪂

Anthony Scalisi scalp42

🪂
View GitHub Profile

About the pic

Choria supports Federating multiple collectives of nodes into a large Federated collective for the purpose of orchestrating.

Federation Requests have:

  • A orchestration request as normal
  • Special headers listing which nodes its for

The client chops a large request into bundles of 200 nodes and publish them to the network for federation. Multiple federation brokers can thus take care of distributing it.

@scalp42
scalp42 / overloading.cr
Created October 29, 2017 20:04
Multiple types overloading
def add(x : Number, y : Number)
x + y
end
def add(x: Number, y: String)
x.to_s + y
end
# vs
1x NOP\nop-item.lua:140: script ran too long
NOP\nop-item.lua:140: in function `ItemScan'
NOP\nop-item.lua:286: in function `ItemShowNew'
NOP\nop-item.lua:366: in function `?'
AllPlayed\libs\AceTimer-3.0\AceTimer-3.0-17.lua:53: in function <AllPlayed\libs\AceTimer-3.0\AceTimer-3.0.lua:48>
Locals:
self = <table> {
printt = <function> defined @NOP\nop-core.lua:7
itemLoadRetry = 10
adns aspcud autoconf automake bash berkeley-db boost cairo camlp4 clasp cloog coreutils cowsay curl dirmngr docker docker-compose docker-machine docker-machine-driver-xhyve doxygen dpkg exif expat fakeroot ffmpeg flac fontconfig fortune freetype fribidi gcc [email protected] gd gdbm gecode gettext git git-open glib gmp gnu-tar gnupg gnutls go gobject-introspection gpg-agent graphviz gringo hadolint harfbuzz heroku htop-osx httpie hub icu4c imagemagick isl isl jansson jpeg jq jshon lame libass libassuan libcaca libebml libev libevent libexif libffi libgcrypt libgit2 libgpg-error libksba libmagic libmatroska libmpc [email protected] libogg libpng libssh2 libtasn1 libtiff libtool libunistring libusb libusb-compat libvo-aacenc libvorbis libyaml little-cms2 lua mas maven mercurial mkvtoolnix mpfr mpfr@2 mplayer mpv nano ncdu ncurses nettle node npth ocaml ocamlbuild oniguruma opam openssl ossp-uuid p11-kit pcre phantomjs pigz pinentry pixman pkg-config popt pth pv python python3 readline redis rpm ruby rust sbt scala siege spoof-m
@scalp42
scalp42 / fetch-tmpl-content
Created May 27, 2017 00:13 — forked from seeder/fetch-tmpl-content
Used for fetching templates from consul for use in consul-template as plugin
#!/bin/sh
TMPL=$1
DESTINATION=/config/consultemplate/template/$TMPL
TMPDESTINATION=/tmp/$DESTINATION
LOGS=/logs/$HOSTNAME
mkdir -p $LOGS
mkdir -p "`dirname $DESTINATION`"
@scalp42
scalp42 / kms_example.sh
Created May 22, 2017 03:48 — forked from elblivion/kms_example.sh
AWS KMS for Chef data bags
$ aws kms encrypt --key-id arn:aws:kms:us-east-1:<my_account>:key/<my_key> --plaintext $(cat ~/.chef/prod-secret) --query CiphertextBlob --output text | base64 -D > secret
$ aws kms decrypt --ciphertext-blob fileb://secret --output text --query Plaintext | base64 -D > decoded
$ if [[ "$(cat decoded)" == "$(cat ~/.chef/prod-secret)" ]]; then echo "got back original chef secret"; fi
got back original chef secret
@scalp42
scalp42 / ruby-blocks-procs-lambdas.md
Created March 27, 2017 00:40 — forked from cflee/ruby-blocks-procs-lambdas.md
Discoveries about Ruby Blocks, Procs and Lambdas

Ruby: Blocks, Procs, Lambdas

Note that for blocks, {} and do ... end are interchangeable. For brevity, only the former will be listed here.

Version differences

Pre-1.9, lambda and proc are synonyms. Essentially the difference is between proc and block.

def method(&block) p block.class; p block.inspect; end
l = lambda { 5 }
@scalp42
scalp42 / ruby-blocks-procs-lambdas.md
Created March 27, 2017 00:40 — forked from cflee/ruby-blocks-procs-lambdas.md
Discoveries about Ruby Blocks, Procs and Lambdas

Ruby: Blocks, Procs, Lambdas

Note that for blocks, {} and do ... end are interchangeable. For brevity, only the former will be listed here.

Version differences

Pre-1.9, lambda and proc are synonyms. Essentially the difference is between proc and block.

def method(&block) p block.class; p block.inspect; end
l = lambda { 5 }
I do apps for a living, and lots of the people I do apps for need to make companies. In addition to owning and operating a couple myself, I am often somewhat involved in the creation of others. There are many types of company you can make, and they each have different use cases and tax advantages and audit risks
Type one for small companies that do not expect to carry over losses very often, and do not need foreign ownership or venture capital:
LLC Filed federally as a C-corporation, promoted to a S-Corp shortly after founding for the purposes of taxes: This is what I have. You have to file taxes for it separately, but you largely do not pay tax directly from this for income taxes, but you don't have to do things like hold director meetings with yourself, or maintain minutes. You get the flexibility of a LLC operating agreement, and you can employ yourself easily as well. This form is also rarely audited, and the nature of the tax structure makes book keeping rather easy, taxes rather easy, and keeping your
@scalp42
scalp42 / paginate.rb
Created January 2, 2017 10:06 — forked from soveran/paginate.rb
Pagination helper for Ohm models.
def paginate(collection, options = {})
start = options[:start] || 0
limit = options[:limit] || 0
order = options[:order]
rest = collection.size > (start + limit)
page = collection.sort(order: order, start: start, limit: limit)
[rest, page]
end