Skip to content

Instantly share code, notes, and snippets.

View nicroto's full-sized avatar

Nikolay Tsenkov nicroto

View GitHub Profile
@nicroto
nicroto / reproduce-issue.ts
Created April 20, 2024 07:32
tsx can't run/transpile endent
import endent from 'endent';
const stringProcessor = (str: TemplateStringsArray) => {
return ` ${str.join()}`;
};
function main() {
// console.log(stringProcessor`test`); // this works
console.log(endent`test`); // this FAILS
}
@nicroto
nicroto / curl.md
Created July 8, 2018 16:14 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@nicroto
nicroto / docker-cleanup-resources.md
Created June 22, 2018 15:15 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@nicroto
nicroto / 1_kubernetes_on_macOS.md
Created June 1, 2018 08:39 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

Wed May 23 08:15:30 UTC 2018
@nicroto
nicroto / server.js
Created September 27, 2016 14:46
NodeJS server for a single-page app with client navigation and no backend.
'use strict';
var http = require( "http" ),
pathUtils = require( "path" ),
express = require( "express" ),
app = express(),
PORT = process.env.PORT || 5000,
appDir = pathUtils.resolve( __dirname, "client" );
app.use( express.static( appDir ) );
Process: SafariForWebKitDevelopment [28824]
Path: /Applications/Safari.app/Contents/MacOS/SafariForWebKitDevelopment
Identifier: com.apple.Safari
Version: 9.0 (11601.1.56)
Build Info: WebBrowser-7601001056000000~2
Code Type: X86-64 (Native)
Parent Process: WebProcess [28821]
Responsible: SafariForWebKitDevelopment [28824]
User ID: 502
div.article-body p {
color: #050505;
}
a.external {
color: #4385a3;
}
h1, h2, h3 {
color: #080808;
@nicroto
nicroto / 1-reproduce-test.js
Last active August 29, 2015 13:57
PhantomJS crash when using node-phantom (report, code reproducing the issue)
'use strict';
var pathUtils = require("path"),
http = require("http"),
nodePhantom = require('node-phantom'),
should = require('should'),
phantomPath = pathUtils.resolve( pathUtils.join( __dirname, "../bin/phantomjs" ) ),
phantom;
var server = http.createServer( function(request,response) {
@nicroto
nicroto / from-api.js
Created February 7, 2014 19:14
Sample to Browserify's issue #638
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions: