Skip to content

Instantly share code, notes, and snippets.

View SlyDen's full-sized avatar

Denys Slipetskyy SlyDen

  • Lviv, Ukraine
View GitHub Profile
Run powershell as administrator:
-posh-gvm installation:
Execute (new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/flofreud/posh-gvm/master/GetPoshGvm.ps1') | iex
Execute Import-Module posh-gvm
// if you have problems with execution policy (https://msdn.microsoft.com/powershell/reference/5.1/Microsoft.PowerShell.Core/about/about_Execution_Policies)
// Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
// later return to old value
Execute gvm help to get started!
-sdkman installation:
Statistics stats = sessionFactory.getStatistics();
long queryCount = stats.getQueryExecutionCount();
long collectionFetchCount = stats.getCollectionFetchCount();
@cibernox
cibernox / Instructions.md
Last active April 3, 2017 14:14
Higher Order Component's Quest
@BretFisher
BretFisher / docker-for-mac.md
Last active May 23, 2024 22:25
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@harshavardhana
harshavardhana / Dockerfile
Last active June 8, 2017 12:24
Docker registry
FROM registry:2.6
COPY config.yml /etc/docker/registry/config.yml
@geoffreydhuyvetters
geoffreydhuyvetters / react_fiber.md
Last active January 13, 2023 06:49
What is React Fiber? And how can I try it out today?
@daliborgogic
daliborgogic / delay.js
Created December 16, 2016 15:26
Node.js Async/Await delay
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {
@marianogappa
marianogappa / backpressure.go
Created December 4, 2016 04:53
Example backpressure implementation in Go
/*
This snippet is an example of backpressure implementation in Go.
It doesn't run in Go Playground, because it starts an HTTP Server.
The example starts an HTTP server and sends multiple requests to it. The server starts denying
requests by replying an "X" (i.e. a 502) when its buffered channel reaches capacity.
This is not the same as rate-limiting; you might be interested in https://github.com/juju/ratelimit
or https://godoc.org/golang.org/x/time/rate.
@odrotbohm
odrotbohm / AmbiguitySample.java
Created November 15, 2016 15:50
Compiler ambiguity when compiling with target JDK 8
public class AmbiguitySample {
/**
* This compiles when using a JDK 8 with target JDK 6 but fails when the target is JDK 8.
*/
public static void main(String[] args) {
CriteriaBuilder builder;
Expression<Object> objectExpression;
Expression<Collection<Object>> collectionOfObjectExpression;
@bithavoc
bithavoc / postgres-notify-trigger.sql
Last active February 2, 2019 09:31
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');