Skip to content

Instantly share code, notes, and snippets.

Yevgeniy Brikman brikis98

Block or report user

Report or block brikis98

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brikis98
brikis98 / main.tf
Last active Aug 18, 2019
A hacky way to create a dynamic list of maps in Terraform
View main.tf
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of
@brikis98
brikis98 / CheckBoxes.html
Created Jul 26, 2011
Proposed syntax for a Markdown extension that would support form elements
View CheckBoxes.html
<label>Phones:</label>
<input type="checkbox" name="phones" id="Android" value="Android"/><label for="Android">Android</label>
<input type="checkbox" name="phones" id="iPhone" value="iPhone" checked="checked"/><label for="iPhone">iPhone</label>
<input type="checkbox" name="phones" id="Blackberry" value="Blackberry" checked="checked"/><label for="Blackberry">Blackberry</label>
@brikis98
brikis98 / echo.js
Last active Feb 15, 2019
Echo server in socket.io
View echo.js
var io = require('socket.io').listen(80);
io.sockets.on('connection', function (socket) {
console.log("Someone just connected!");
// Echo back messages from the client
socket.on('message', function (message) {
console.log("Got message: " + message);
socket.emit('message', message);
});
@brikis98
brikis98 / gist:1024230
Created Jun 14, 2011
Java GC log explanation (Young Generation collections)
View gist:1024230
{Time since VM started, in seconds}: [GC {Time since VM started}: [{GC type}
Desired survivor size {size of one survivor space} bytes, new threshold {y} (max {x}) <- how many collections objects can stay in the young gen. More on this later
- age 1: {a} bytes, {a} total <- How many objects have survived one collection. Next collection, any surviving objects will appear in age 2
- age 2: {b} bytes, {a+b} total
: {pre-collection young gen[5] usage}K->{post-collection young gen usage}K({Total young gen size}K), {young gen time} secs]
{pre-collection heap size}K->{post-collection heap size}K({total heap size}K), {total collection time} secs]
@brikis98
brikis98 / gist:e71d6c736158080968f5
Created Apr 16, 2015
Getting a sorted list of tags in Jekyll with no plugins
View gist:e71d6c736158080968f5
{% capture tags %}{% for tag in site.tags %}{{ tag[0] }}|{% endfor %}{% endcapture %}
{% assign sortedtags = tags | split:'|' | sort %}
{% for tag in sortedtags %}
<a name="{{ tag }}"></a>
<h2>{{ tag }}</h2>
<ul>
{% for post in site.tags[tag] %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
@brikis98
brikis98 / gist:1024235
Created Jun 14, 2011
Java GC log explanation (CMS)
View gist:1024235
{Time since VM started, in seconds}: [GC
[1 CMS-initial-mark: {estimated old gen usage}K({total old gen size}K)] {estimated heap usage}K({total heap size}K), {pause time} secs]
{Time since VM started, in seconds}: [Rescan (parallel) , {pause time} secs]
{Time since VM started, in seconds}: [weak refs processing, {pause time} secs]
[1 CMS-remark: {old gen usage}K({total old gen size}K)] {heap usage}K({total heap size}K), {pause time} secs]
{Time since VM started, in seconds}: [CMS-concurrent-reset: 0.019/0.019 secs]
@brikis98
brikis98 / gist:1024233
Created Jun 14, 2011
Java GC log example (CMS)
View gist:1024233
294989.748: [GC
[1 CMS-initial-mark: 1782676K(2097152K)] 1784501K(3137664K), 0.0067714 secs]
295047.329: [Rescan (parallel) , 0.2497803 secs]
295047.579: [weak refs processing, 0.1272999 secs]
[1 CMS-remark: 1782929K(2097152K)] 2303079K(3137664K), 0.3816787 secs]
295049.065: [CMS-concurrent-reset: 0.019/0.019 secs]
@brikis98
brikis98 / gist:1024228
Created Jun 14, 2011
Java GC log example (Young Generation collections)
View gist:1024228
325209.429: [GC 325209.429: [ParNew
Desired survivor size 4128768 bytes, new threshold 2 (max 2)
- age 1: 1812544 bytes, 1812544 total
- age 2: 305568 bytes, 2118112 total
: 1034582K->2103K(1040512K), 0.0116910 secs]
2598263K->1565814K(3137664K), 0.0118312 secs]
@brikis98
brikis98 / framework.html
Created Jul 22, 2011
Getting started with LinkedIn API's
View framework.html
<!-- Add the following to the head of your webpage: -->
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: your_api_key_goes_here
</script>
@brikis98
brikis98 / Cache.scala
Last active Mar 14, 2018
A quick hack to wrap Java's ConcurrentHashMap with a slightly more scala-friendly API. Scala's built-in ConcurrentMap does the same thing, but its getOrElseUpdate is NOT atomic. Hopefully, the getOrElseUpdate in the version below works correctly :)
View Cache.scala
package com.linkedin.playplugins.common.util
import Cache._
import play.api.Configuration
import java.util.concurrent.ConcurrentHashMap
import collection.JavaConverters._
/**
* A Scala wrapper for a Java's ConcurrentHashMap (CHM). Exposes the basic underlying methods of CHM and adds a
* getOrElseUpdate(key, value) method that lazily evaluates the value parameter only if the key is not already present
You can’t perform that action at this time.