Skip to content

Instantly share code, notes, and snippets.

View daniel-bytes's full-sized avatar
💭
👾

Daniel Battaglia daniel-bytes

💭
👾
View GitHub Profile
function git-reset-commits(){
branch=$(git branch | grep \* | cut -d ' ' -f2)
remote=upstream
basebranch=$branch
if [ "$#" = 1 ]; then
basebranch=$1
elif [ "$#" -gt 1 ]; then
remote=$1
@daniel-bytes
daniel-bytes / disable-adminconsole-indexer.sh
Last active September 20, 2023 22:19
ECE found-shell script to disable indexer mode and migrations for the adminconsole container. Create this file, chmod +X it, run it with the bypass option (1), fix your env, run the script again with the cleanup option (2)
#!/bin/bash
set -e
echo "=================================================================================================="
echo "NOTE: The script will set the Adminconsole to api-only mode (no indexer), so that"
echo " migrations are bypassed and Adminconsole can boot for environment salvage operations."
echo " Please run the same script with the cleanup option afterwards."
echo ""
echo "IMPORTANT: Until the cleanup script is run, adminconsole will not be able to index "
echo " changes in the admin cluster, breaking the Deployments dashboard and "
docker run \
-v $(pwd):/hostpwd -v ~/.found-shell:/elastic_cloud_apps/shell/.found-shell \
--env SHELL_ZK_AUTH=$(docker exec -it frc-directors-director bash -c 'echo -n $FOUND_ZK_READWRITE') $(docker inspect -f '{{ range .HostConfig.ExtraHosts }} --add-host {{.}} {{ end }}' frc-directors-director) --rm -it $(docker inspect -f '{{ .Config.Image }}' frc-directors-director) \
/elastic_cloud_apps/shell/run-shell.sh
function git-reset-commits(){
branch=$(git branch | grep \* | cut -d ' ' -f2)
remote=upstream
basebranch=$branch
if [ "$#" = 1 ]; then
basebranch=$1
elif [ "$#" -gt 1 ]; then
remote=$1
@daniel-bytes
daniel-bytes / ScTutorialGendy.sc
Created September 23, 2018 16:29
Gendy Tutorial
// Copied from https://composerprogrammer.com/teaching/supercollider/sctutorial/1.1%20Getting%20Started.html
({
var n = 11; //try changing me to 34, or 3, and then re-running...
Resonz.ar(
Mix.fill(n,{
var freq=rrand(50,560.3);
var numcps= rrand(2,20);
Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq ,freq, 1.0.rand, 1.0.rand, numcps, SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
}),
@daniel-bytes
daniel-bytes / gendy-tutorial.lua
Created September 23, 2018 16:23
gendy-tutorial
engine.name = "GendyTutorial"
function init()
-- map our supercollider controls to norns parameters
params:add_control("x", controlspec.new(100,2000,"lin",0,0,""))
params:set_action("x", function(x) engine.x(x) end)
params:add_control("y", controlspec.new(0.01, 1.0,"lin",0,0,""))
params:set_action("y", function(x) engine.y(x) end)
@daniel-bytes
daniel-bytes / Engine_GendyTutorial.sc
Last active September 23, 2018 16:07
Engine_GendyTutorial
Engine_GendyTutorial : CroneEngine {
var rez_x=100, rez_y=0.5, fill=50;
var <synth;
*new { arg context, doneCallback;
^super.new(context, doneCallback);
}
alloc {
SynthDef(\GendyTutorial, {|inL, inR, out, rez_x=100, rez_y=0.5|

Keybase proof

I hereby claim:

  • I am daniel-bytes on github.
  • I am danielbytes (https://keybase.io/danielbytes) on keybase.
  • I have a public key ASDCF74YZgZPz3I55FBxL-8uimfBWg5Lq0xwFBFPq0-hbAo

To claim this, I am signing this object:

def publish_event(event, prefix: '')
routing_key = build_routing_key(event, prefix)
payload = build_event_payload(event)
channel_pool.with do |channel|
channel.
topic(eventbus_exchange, durable: true).
publish(payload, routing_key: routing_key)
end
end
class StateTransitionEvent
include Mongoid::Document
include Mongoid::Timestamps::Created
field :entity_type, type: String
field :entity_id, type: BSON::ObjectId
field :entity_attributes, type: Hash
field :event, type: String
field :from, type: String
field :to, type: String