Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefan Botzenhart basiszwo

View GitHub Profile
@basiszwo
basiszwo / google-cloud-memorystore-dump.md
Last active May 8, 2019
Dump Redis rdb file from Google Cloud MemoryStore
View google-cloud-memorystore-dump.md

Dumping a redis rdb file from a Google Cloud MemoryStore is easier than expected using redis-cli

Command

redis-cli -h <IP of MemoryStore Instance> --rdb dump.rdb
@basiszwo
basiszwo / active_record_query_locator.rb
Created Apr 23, 2018
Find active record query location
View active_record_query_locator.rb
module ActiveRecord
class QueryLocator
def call(name, started, finished, unique_id, payload)
# filter caller locations to application backtrace (filter all gem calls)
# see http://ruby-doc.org/core-2.5.0/Kernel.html#method-i-caller_locations for more options
caller_names = caller_locations.select { |line| line.to_s =~ /#{Rails.root.to_s}/ }
# use the last caller in backtrace
caller_name = caller_names.first
Rails.logger.debug ["Notification:", name, started, finished, unique_id, caller_name, payload].join(" - ")
@basiszwo
basiszwo / FileHelpers.java
Last active Jan 23, 2018
Load local json and feed to accumulo instance
View FileHelpers.java
package one.flak.flinkgeomesa;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
@basiszwo
basiszwo / fizzbuzz.rb
Created Aug 8, 2017
FizzBuzz Implementation
View fizzbuzz.rb
fizz = ["", "", "Fizz"].lazy.cycle
buzz = ["", "", "", "", "Buzz"].lazy.cycle
pattern = fizz.zip(buzz).map(&:join)
p pattern.take(15).to_a.join(", ")
numbers = (1..Float::INFINITY).lazy.map(&:to_s)
fizzbuzz = numbers.zip(pattern).map(&:max)
@basiszwo
basiszwo / osx-install.md
Last active Jan 2, 2016
Create Installation Image from OS X AppStore Update
View osx-install.md

How to create an OSX installation image (USB stick)

  • download upgrade from appstore
  • prepare an USB stick with ~ 5GB space; format journaled with GUID partition table
  • use the following command
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Stick --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
You can’t perform that action at this time.