Skip to content

Instantly share code, notes, and snippets.

@maxleiko
maxleiko / main.rs
Created June 12, 2021 09:44
Benchmark different buffer copy methods for Rust vec
/// You need this as dependency in Cargo.toml
///
/// [dependencies]
/// time = "0.2.26"
use std::collections::HashMap;
use std::env;
use std::ptr;
use time::Duration;
@maxleiko
maxleiko / s3-list-object.ts
Created August 14, 2020 09:48
S3 listObjects async generator
import S3, { ObjectList } from 'aws-sdk/clients/s3';
import { PromiseResult } from 'aws-sdk/lib/request';
import { AWSError } from 'aws-sdk/lib/error';
export async function* listObjects(
s3: S3,
Bucket: string,
Prefix?: string | undefined,
StartAfter?: string | undefined,
): AsyncGenerator<ObjectList> {
alias dim="docker images"
alias dps="docker ps"
alias drm="docker rm"
alias drmi="docker rmi"
alias drme="docker ps -a | grep Exited | cut -d' ' -f1 | xargs docker rm"
# Deletes all docker containers (if stopped, otherwise use -f)
function drma() {
drm $1 $(dps -aq)
}
@maxleiko
maxleiko / mutants.json
Created April 19, 2018 14:23
Mutants for jitsi-videobridge
[
{
"name": "mutant-e672f11",
"dir": ".results/jitsi-videobridge/e672f1197ab401f4e04b735e00c4409219638efce0cadcb8ef2cff47cd6a70a9",
"hash": "e672f1197ab401f4e04b735e00c4409219638efce0cadcb8ef2cff47cd6a70a9",
"dependencies": [
{
"g": "org.fusesource",
"a": "sigar",
"v": "1.6.4"

Keybase proof

I hereby claim:

  • I am maxleiko on github.
  • I am leiko (https://keybase.io/leiko) on keybase.
  • I have a public key ASAfTxkA2Me9t0PfXIVshdlBUkjKSUS_h5fjFjQyQm4Pbwo

To claim this, I am signing this object:

@maxleiko
maxleiko / app.js
Created January 17, 2018 09:56
ES6 async/await example
async function main() {
async function asyncJob() {
return new Promise((resolve) => {
// something async that will resolve in 1000ms
setTimeout(() => {
resolve(42);
}, 1000);
});
}
@maxleiko
maxleiko / first-pass.json
Created October 11, 2017 12:39
Diversify JHipster app
[
{
"isValid": false,
"path": "gen/jhipster-sample-app-0-0",
"deps": [
{
"g": "io.github.jhipster",
"a": "jhipster",
"v": "1.1.12"
}
@maxleiko
maxleiko / docker-helper.sh
Last active July 17, 2019 07:50
Copy/past this in your .bashrc / .zshrc / .whateverrc
alias dim="docker images"
alias dps="docker ps"
alias drm="docker rm"
alias drmi="docker rmi"
# Deletes all docker containers (if stopped, otherwise use -f)
function drma() {
drm $1 $(dps -aq)
}
const hello = (msg) => console.log(`Message: ${msg}`);
hello('Hello world');
function MyType() {
this.id = null;
}
function privateMethod(foo, bar) {
console.log('private work on instance: ' + this.id);
console.log(foo, bar);
}
MyType.prototype.publicMethod = function () {