Skip to content

Instantly share code, notes, and snippets.

@shyiko
shyiko / .sh
Created Aug 26, 2020
prometheus/client_golang default metrics
View .sh
# 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 Jun 16, 2019
go sync/weakmap
View weakmap.go
package weakmap
import (
"reflect"
"runtime"
"sync"
)
type Key = interface {}
type Value = interface {}
@shyiko
shyiko / for_each.c
Created Feb 9, 2019 — forked from pancurster/for_each.c
for_each in C
View for_each.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 / mvn-confict-resolver.kts
Created Aug 29, 2017
Maven Conflict Resolver
View mvn-confict-resolver.kts
// 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 Jul 26, 2017
semaphore over amqp (POC)
View index.js
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 Apr 21, 2017
jsbin :: vue-document
View index.html
<!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 / deployment_to_gitlab_pages.md
Created Apr 10, 2017
Deploying to GitLab Pages (on each push)
View deployment_to_gitlab_pages.md

(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 / index.html
Last active Dec 24, 2016
jsbin :: canvas-text-opentypejs-shim :: fabric
View index.html
<!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>
@shyiko
shyiko / index.html
Last active Dec 24, 2016
jsbin :: canvas-text-opentypejs-shim
View index.html
<!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</title>
</head>
<body>
@shyiko
shyiko / google_font_downloader
Created Oct 22, 2016 — forked from jakeg/google_font_downloader
Download all Google fonts using sensible FVD-style names
View google_font_downloader
/*
Script to download all google fonts and name them with FVD-based filenames
- e.g. Rock_Salt.n4.ttf, Open_Sans.i7.ttf
*/
var https = require('https');
var http = require('http');
var fs = require('fs');
var async = require('async');
var key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // google fonts api server-only key
You can’t perform that action at this time.