Skip to content

Instantly share code, notes, and snippets.

@frankyn
frankyn / stream_upload.rb
Last active April 10, 2023 22:51
Using Cloud Storage resumable upload with a signed URL in Ruby
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@emilio2hd
emilio2hd / README.md
Last active July 7, 2022 14:56
Docker + Elasticsearch + Logstash + Kibana

Configuring Elasticsearch + Logstash + Kibana using Docker

Here, there are some configs to use Elasticsearch as a Docker container and Logstash + Kibana as well.

You will see that Elasticsearch config is separated from Logstash and Kibana because I'm assuming that you want to use the ES container to other things rather than only log analyses.

Docker instalation

Go to https://docs.docker.com/install/ and open the "Docker CE" menu, choose you OS and follow their instructions.

After install, open your terminal and type:

@benoittgt
benoittgt / in_relentless_pursuit_of_rest_notes.md
Created October 20, 2017 12:42
"In Relentless Pursuit of Rest" from Derek Prior
@sheerun
sheerun / .bowerrc
Last active March 19, 2023 02:27
Proper .bowerrc file pointing to new Bower registry (if using legacy Bower version)
{
"registry": "https://registry.bower.io"
}

Subscriptions

  • Learn how to set up basic subscriptions
  • Create composable service objects
  • Advanced subscriptions techniques

So far in this book we've talked about how to sell products once. A customer selects a product, puts their information in, and hits the "buy now" button, and that's end of our interaction with them.

@simonw
simonw / recover_source_code.md
Last active September 28, 2024 08:10
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@mcshakes
mcshakes / Rails C error.
Created October 14, 2016 23:45
Running into RVM and readline issues
$ rails c
Running via Spring preloader in process 7916
/Users/edmac/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
Referenced from: /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Reason: image not found - /Users/edmac/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin14/readline.bundle
Fixed with:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
@mildavw
mildavw / gist:cadb39940fd06c19981f6f0586940214
Last active September 20, 2018 15:18
Are you losing sleep() over intermittent Capybara test failures? You should!

Used properly, the waiting strategy that certain Capybara matchers employ can solve most of those pesky intermittently failing full-stack/browser tests. Pretty much all of them† are due to race conditions between the processes running your tests, the app you're testing, and the browser (which includes both the rendering of the dom, your javascript running there, and if you're calling outside services, The Internet.) The race condition may resolve with 100% consistency on your local dev machine, but when your CI server runs the code, sometimes one process wins, sometimes another. The result is an intermittently failing test that you can only repro on a remote CI machine.

If your developent environment is significantly different than the CI environment, the barriers to effectively troubleshooting the problem may be too high. What I've seen a lot of developers do is just "punt" and insert a sleep(2) in their tests to increase the probabilty that the other processes finish first. And then write the test assumi

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@mfikes
mfikes / fast.md
Last active January 6, 2024 07:19
Fast Clojure REPL

An experimental change for fast Clojure REPL startup:

  1. Download the JAR: clojure-1.8.0-fast.jar
  2. Launch it via java -jar clojure-1.8.0-fast.jar

The code used to create this JAR is on GitHub.

What's it doing?

It is: