Skip to content

Instantly share code, notes, and snippets.

@headius
headius / meltdown_in_a_nutshell.md
Last active July 27, 2018 13:43
How Meltdown Works

Algorithm

  1. A secret byte you want to read is stored at inaccessible memory location priv_mem.
  2. The sender triggers an access exception by attempting to read priv_mem.
  3. Due to CPU optimization (out-of-order execution), the load of secret from priv_mem and the use of its value in (4) and (5) below may execute before the exception is triggered.
  4. Calculate an offset into a known array probe by multiplying secret by the width of a cache line (or whatever block size the CPU typically fetches, like a 4096-byte page). This guarantees each of those 256 possible offsets will cache separately.
  5. Load probe[offset], which causes the CPU to cache exactly one chunk of of our array, populating one cache line.
  6. The exception finally triggers, clearing the modified registers...but cached data is not excised.
  7. Iterate over all 256 offsets into probe to find out which one loads fast. You've determined the value of secret.
@deviantony
deviantony / README.md
Last active July 7, 2024 01:37
Portainer HTTP API by example

DEPRECATION NOTICE

This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!

THE FOLLOWING DOCUMENTATION IS DEPRECATED

Please refer to the link above to get access to our updated API documentation and examples.

@amir-rahnama
amir-rahnama / stackfile.yml
Last active October 22, 2017 00:58
Stackfile for Docker Cloud ElasticSearch Cluster (with Kibana)
es-master:
image: 'elasticsearch:latest'
command: 'elasticsearch --network.host=0.0.0.0 --node.master=true --cluster.name=escluster'
restart: always
es-develop:
image: 'elasticsearch:latest'
command: 'elasticsearch --network.host=0.0.0.0 --cluster.name=escluster --discovery.zen.ping.unicast.hosts=es-master'
deployment_strategy: high_availability
links:
- es-master
@modius
modius / elk.yml
Created February 17, 2016 04:59
ELK Stack DockerCloud
elasticsearch:
image: 'elasticsearch:1.5'
ports:
- '9200:9200'
logstash:
image: 'logstash'
command: 'logstash -e "input { syslog { port => 12345 type => "docker" } } output { elasticsearch { hosts => "elasticsearch" } }"'
expose:
- '12345/tcp'
@bholloway
bholloway / 01. Composition.md
Last active January 10, 2018 17:43
Angular ES6 Cheatsheet

Composition

It is important not to hide composition. It should be done centrally, at the root of the application.

In angular there are 2 different resources we must compose in order to build an application

  • Using a composition root we map directives, controllers, and services into the injector.

  • Using routing we compose views from HTML partials and controllers for each different application state.

# This file extends and overrides parts of the ActiveAdmin DSL and internals
# in order to provide support for automatically displaying and editing images,
# which in our infrastructure are stored as URLs whose column names end in "img".
# Since this file will be reloaded frequently in the development environment,
# all operations done at load time (class_eval's, etc.) MUST be idempotent.
ActiveAdmin::Views::TableFor.class_eval do
def img_column(col_sym=:img, title="Image")
column title, sortable: false do |obj|
@ericboehs
ericboehs / gist:7125105
Created October 23, 2013 19:30
Poltergeist hack to silence CoreText performance notes from phantomjs
module Capybara::Poltergeist
class Client
private
def redirect_stdout(to)
prev = STDOUT.dup
prev.autoclose = false
$stdout = to
STDOUT.reopen(to)
prev = STDERR.dup
@DouweM
DouweM / VerEx.rb
Last active March 8, 2016 00:44 — forked from svineet/VerEx.rb
# This is a program trying to implement Verbal Expressions
# See this for more info - http://verbalexpressions.github.io/
def VerEx
VerExClass.new
end
class VerExClass
attr_accessor :regex
@bigfive
bigfive / active_admin_helper.rb
Last active November 15, 2018 21:33
Active admin reskin
module ActiveAdminHelper
def admin_arbre_context
@admin_arbre_context ||= Arbre::Context.new(assigns, self)
end
def default_renderer
case controller.send(:resource_class).name
when "ActiveAdmin::Page"
"page"