Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View marcomorain's full-sized avatar

Marc O'Morain marcomorain

View GitHub Profile
(ns binding
(:import java.util.concurrent.Executors))
(def thread-pool
(Executors/newFixedThreadPool 1))
(set-agent-send-off-executor! thread-pool)
(def counter (agent 0))
@marcomorain
marcomorain / gist:684e5febf6235fd9b5a95cfc48aaf2a4
Created October 29, 2019 11:18
A Clojure Unit Test Has Failed
Testing circleci.vm-service.vms-test
FAIL in (provision-vm-sets-provision-result) (clojure_test.cljc:30)
Instant start and SSH successful
{:result #error {
:cause Validation failed: writeKey must not be null or empty
:via
[{:type java.lang.IllegalArgumentException
:message Validation failed: writeKey must not be null or empty
:at [io.honeycomb.libhoney.utils.Assert notEmpty Assert.java 40]}]
desc 'Renew push certifications and store them on the server'
lane :renew_certificate do
fastlane_require 'spaceship'
config = whitelabel(type: :store, download: false)
# If we are at the limit of push certificates (2), then revoke
# the oldest.
Spaceship::Portal.login
existing_certificates = Spaceship::Portal.certificate.production_push.all
.select {|c| c.owner_name == config.bundle_id }
(defn anglo [num]
(apply str
(reverse
(flatten
(interpose ","
(partition 3 3 (repeat "")
(reverse (str num))))))))
(anglo "12345678900") => "12,345,678,900"
(defn future-call [f]
;; Before we start the future grab a copy of the current stack
(let [stack (.getStackTrace (Exception.))]
(future
(try
(f)
(catch Exception e
;; An exception thrown from a future has a stack that does not
;; include the outer stack trace. We can fix this by appending
;; the stack trace we captured above into the caught exception.
@marcomorain
marcomorain / clojure.md
Last active October 17, 2018 08:55
Clojure Error Messages

Clojure 1.8

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.8.0"}}}'
Clojure 1.8.0
user=>  (let [2])
IllegalArgumentException let requires an even number of forms in binding vector in user:1  clojure.core/let (core.clj:4333)

Clojure 1.9

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.9.0"}}}'

(S)ELF-EXPLOITATION

Jonathan Garrett, Insomniac Games

RATCHET AND CLANK: UP YOUR ARSENAL was an online title which shipped without the ability to patch either code or data. Which was unfortunate.

The game downloads and displays an End User License Agreement each time it’s launched. This is an ascii string stored in a static buffer. This buffer is filled from the server without checking that the size is within the buffer’s capacity.

We exploited this fact to cause the EULA download to overflow the static buffer far enough to also overwrite a known global variable. This variable happened to be the function callback handler for a specific network packet. Once this handler was installed, we could send the network packet to cause a jump to the address in the overwritten global. The address was a pointer to some payload code which was stored earlier in the EULA data.

Valuable data existed between the real end of the EULA buffer and the overwritten global, so the first job of the payload code was to restore

@marcomorain
marcomorain / Promise.java
Created February 8, 2017 10:55
A Java Implementation of Clojure's promises
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
public class Promise<T> {
private final CountDownLatch latch = new CountDownLatch(1);
private final AtomicReference<T> value = new AtomicReference<>();
public void deliver(T value) {
Error 503 No healthy backends
No healthy backends
Guru Mediation:
Details: cache-lhr6324-LHR 1484232928 1781317846
Varnish cache server
@marcomorain
marcomorain / whitespace.tsx
Created October 11, 2016 11:11
Visual Studio Code Whitespace Typescript TSX Bug
import * as React from 'react'
var restaurantName = 'My Restaurant'
var closedAlert: JSX.Element = (
<h4>{restaurantName} is Closed</h4>
)