Skip to content

Instantly share code, notes, and snippets.

View nerg4l's full-sized avatar

László GÖRÖG nerg4l

View GitHub Profile
@nerg4l
nerg4l / log.txt
Created May 21, 2022 20:58
herokuish on arm64
$ docker run --rm -v /abs/app/path:/tmp/app gliderlabs/herokuish /bin/herokuish test
::: BUILDING APP :::
 -----> Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
  Detected buildpacks: ruby nodejs
 -----> Ruby app detected
-----> Installing bundler 2.3.10
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.7.4
-----> Installing dependencies using bundler 2.3.10
@nerg4l
nerg4l / time_hours.js
Created October 26, 2021 11:37
LinkedIn Learning progress
([...document.querySelectorAll('.lls-card-detail-card__main')].filter(c => c.innerHTML.match(/COURSE/) && c.innerHTML.match(/Completed.*?\/2021/))
.map(c => c.querySelector('.lls-card-thumbnail-label'))
.map(l => l.innerHTML.trim()).map((str) => {
var m = 0;
var hours = str.match(/(\d+)\s*h/);
var minutes = str.match(/(\d+)\s*m/);
if (hours) { m += parseInt(hours[1])*60; }
if (minutes) { m += parseInt(minutes[1]); }
return m;
}).reduce((a, b) => a + b) / 60)
@nerg4l
nerg4l / uuiddraft.js
Last active August 18, 2021 16:58
UUID draft
const crypto = require('crypto')
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
let poolPtr = rnds8Pool.length;
function rng(size) {
if (poolPtr > rnds8Pool.length - size) {
crypto.randomFillSync(rnds8Pool);
poolPtr = 0;
}
const { Database, aql } = require("arangojs");
const db = new Database({
databaseName: 'got',
});
const Characters = db.collection("characters");
let firstSuccess = false
async function main() {
@nerg4l
nerg4l / README.md
Last active April 25, 2021 07:48
GPG Cheat Sheet

This cheat sheet is for gpg2 which is aliased by the gpg command on Ubuntu.

Switch to Pinentry TTY

sudo apt install pinentry-tty
sudo update-alternatives --config pinentry

Source: https://superuser.com/a/1381147

@nerg4l
nerg4l / README.md
Last active May 18, 2020 09:27
Documentation Flavoured Development

In Documentation Flavoured Development a change in the documentation can indicate a code change.

It builds on top of markdown by adding an extra rule. The syntax is two forward slash (//) at the beginning of a line. The first line contains a chekbox which indicates if the feature is ready or not. [ ] indicates an unchecked checkbox and [x] indicates a checked checkbox. The following lines prefixed with slashes may contain references for developers to find a file, class, method or variable. At least one reference should be added when the feature is "done" and no more than three is recommended.

@nerg4l
nerg4l / flatten1.go
Created November 14, 2019 16:43
exercism - Flatten Array
package flatten
// BenchmarkFlatten-8 244364 4568 ns/op 3232 B/op 80 allocs/op
func Flatten(nested interface{}) []interface{} {
flattened := []interface{}{}
switch x := nested.(type) {
case []interface{}:
for _, v := range x {
flattened = append(flattened, Flatten(v)...)
@nerg4l
nerg4l / README.md
Last active September 18, 2019 13:55
SPA Authentication Flow for Browser Applications
@nerg4l
nerg4l / data.txt
Last active July 16, 2019 10:39
Re: faiface - How to use 'try'
name: Boris Bateman
gender: man
os: Windows
lang: PHP
name: Darin May
gender: woman
os: OSX
lang: JavaScript
@nerg4l
nerg4l / MyRepositoryImpl.java
Last active January 3, 2019 08:25 — forked from jelies/MyRepositoryImpl.java
A Spring FactoryBean to create a Hibernate's StatelessSession to be injected in your custom repository implementation when using Spring Data JPA.
package com.jelies.spring3tomcat7.repository;
import org.hibernate.Criteria;
import org.hibernate.ScrollableResults;
import org.hibernate.StatelessSession;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.joda.time.LocalDate;
import org.springframework.beans.factory.annotation.Autowired;