Skip to content

Instantly share code, notes, and snippets.

Oded Arbel guss77

View GitHub Profile
@guss77
guss77 / VertxBufferOutputStream.java
Created Sep 20, 2018
An output stream implementation over a Vert.x `Buffer` instance - like `ByteArrayOutputStream` but a bit Vert.xified.
View VertxBufferOutputStream.java
import java.io.IOException;
import java.io.OutputStream;
import io.vertx.core.buffer.Buffer;
public class VertxBufferOutputStream extends OutputStream {
private Buffer buffer;
public BufferOutputStream() {
this.buffer = Buffer.buffer();
View google-group-import.sh
#!/bin/bash
function usage() {
(
echo "usage: $0 <auth-token> <group-address> <mbox-dir>"
echo "To generate an auth token go to https://developers.google.com/oauthplayground/ and get an access token for Google Groups migration"
) >&2
exit 5
}
@guss77
guss77 / Futures.java
Created Mar 26, 2018
CompletableFuture helper class
View Futures.java
package tech.greenfield.util.concurrent;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import java.util.function.Function;
public class Futures {
static class Thrower {
static Throwable except;
@guss77
guss77 / update-coreos-amis.sh
Created Dec 6, 2017
Create a YAML mapping file for CloudFormation to select a CoreOS AMI
View update-coreos-amis.sh
#!/usr/bin/ruby
require 'yaml'
require 'json'
require 'net/http'
def get_releases
JSON[Net::HTTP.get_response(URI.parse "https://coreos.com/dist/aws/aws-stable.json").body.gsub(/,\s*\]/,"]")]
end
@guss77
guss77 / update-centos-amis.sh
Created Dec 6, 2017
Create a YAML mapping file for CloudFormation to select a CentOS AMI
View update-centos-amis.sh
#!/bin/bash
(
cat <<EOF
Mappings:
CentOSRegionImages:
EOF
curl -s 'https://wiki.centos.org/Cloud/AWS' | xmllint -html --xpath '//table[1]/tbody/tr' - | perl -nle '
m|CentOS Linux (\d+)| and $version=$1;
@guss77
guss77 / update-ubuntu-amis.sh
Last active Dec 6, 2017
Create a YAML mapping file for CloudFormation to select an Ubuntu AMI
View update-ubuntu-amis.sh
#!/usr/bin/ruby
require 'yaml'
require 'json'
require 'net/http'
def get_releases
JSON[Net::HTTP.get_response(URI.parse "https://cloud-images.ubuntu.com/locator/ec2/releasesTable").body.gsub(/,\s*\]/,"]")]["aaData"]
end
@guss77
guss77 / cloud-formation-computed-variables.yaml
Last active Feb 14, 2019
Computed variables for CloudFormation using an identity function, as by @claude on StackOverflow (https://serverfault.com/a/812040/6438)
View cloud-formation-computed-variables.yaml
##
#
# Custom resource setup to provide an identity function that can be used to
# implement "custom variables".
# See: https://serverfault.com/a/812040/6438
#
# Usage:
#
# After deploying the below code to your stack, you can define computed
# variables thus:
@guss77
guss77 / keybase.md
Created Apr 24, 2017
keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am guss77 on github.
  • I am guss77 (https://keybase.io/guss77) on keybase.
  • I have a public key whose fingerprint is 3A14 B9B7 07DF DC0E 70B1 BFB5 F04E ECD3 2769 C738

To claim this, I am signing this object:

@guss77
guss77 / mongo_db_recover_delete_record-2.4.py
Last active Dec 10, 2017
Try to recover deleted documents from a mongodb 2.4 data file. Based on https://gist.github.com/egguy/2788955 with help from https://yazadk.wordpress.com/2015/07/15/a-forensic-perspective-on-recovering-deleted-data-from-big-data-systems/#MongoDB . Make sure to change `decode_chunk` so it properly detects the objects you are trying to recover - i…
View mongo_db_recover_delete_record-2.4.py
#!/usr/bin/python
"""A little script to recover deleted recording of a mongoDB db file
There's no optimization but it work and has saved me
"""
import struct
import bson
import pymongo
You can’t perform that action at this time.