Skip to content

Instantly share code, notes, and snippets.

@shyiko
shyiko / .sh
Created August 26, 2020 22:13
prometheus/client_golang default metrics
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_goroutines Number of goroutines that currently exist.
@shyiko
shyiko / weakmap.go
Created June 16, 2019 04:05
go sync/weakmap
package weakmap
import (
"reflect"
"runtime"
"sync"
)
type Key = interface {}
type Value = interface {}
@shyiko
shyiko / for_each.c
Created February 9, 2019 04:46 — forked from pancurster/for_each.c
for_each in C
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#define for_each(i, list) \
for(i = list; \
i != NULL; \
i = i->next)
struct lista {
@shyiko
shyiko / pom.xml
Created February 12, 2012 18:06
Sonar & JaCoCo & Maven 3 integration
<project ...>
...
<properties>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.reportPath>${user.dir}/target/jacoco.exec</sonar.jacoco.reportPath>
</properties>
...
<build>
<plugins>
@shyiko
shyiko / deployment_to_gitlab_pages.md
Created April 10, 2017 04:06
Deploying to GitLab Pages (on each push)

(assuming project is hosted on GitLab)

  1. Enable shared runners by going to "Settings" > "Runners".
  2. Add .gitlab-ci.yml with the following content:
image: node:6.9.1
pages: 
  artifacts: 
paths: 
@shyiko
shyiko / mvn-confict-resolver.kts
Created August 29, 2017 00:16
Maven Conflict Resolver
// Usage:
// 1. ./mvnw dependency:tree -Dverbose | kotlinc -script mvn-confict-resolver.kts
// 2. update pom.xml's
// <dependencyManagement><dependencies><!-- INSERT 1. OUTPUT HERE --></dependencies></dependencyManagement>
import java.util.Scanner
val input = Scanner(System.`in`).useDelimiter("\\A").next()
println(
Regex("[(]([\\w.-]+:[\\w.-]+:jar:[\\w.-]+):[^ ]+ - omitted for conflict with ([\\w.-]+)")
@shyiko
shyiko / index.js
Last active July 26, 2017 02:57
semaphore over amqp (POC)
const amqp = require('amqplib/callback_api')
const assert = require('assert')
amqp.connect((err, con) => {
assert.ifError(err)
console.log('connected')
con.createChannel((err, ch) => {
assert.ifError(err)
ch.prefetch(1, false)
ch.assertQueue('Q', {durable: false, autoDelete: true, maxLength: 1}, (err) => {
@shyiko
shyiko / index.html
Last active April 21, 2017 09:30
jsbin :: vue-document
<!doctype html>
<title></title>
<meta name="description" content="">
<div id="app"></div>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/vue-document"></script>
<script>
Vue.use(VueDocument, {
injector: [VueDocument.titleInjector, VueDocument.metaInjector]
})
@shyiko
shyiko / index.html
Last active December 24, 2016 03:21
jsbin :: canvas-text-opentypejs-shim :: fabric
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>canvas-text-opentypejs-shim :: fabric</title>
</head>
<body>