Skip to content

Instantly share code, notes, and snippets.

@thatkookooguy
thatkookooguy / sleep-sort.js
Last active May 5, 2024 09:48 — forked from vstarck/sleep_sort.js
Sleep Sort in JavaScript | http://t.co/nWJACyK
// from: http://dis.4chan.org/read/prog/1295544154/170
function sleepSort(list, callback) {
const result = [];
list.forEach((i) => setTimeout(() => {
result.push(i);
if (result.length == list.length) {
callback(result);
}
@taskylizard
taskylizard / fmhy.md
Last active May 5, 2024 09:48
/r/freemediaheckyeah, in one single file (view raw)
@pszemraj
pszemraj / calculate_code_readability.py
Created November 6, 2023 17:01
heuristics for language agnostic code readability index
import re
from itertools import chain
def calculate_readability(code_string:str) -> float:
code = code_string.splitlines()
# Heuristic 1: Line length
max_line_length = 80
long_lines = sum(1 for line in code if len(line) > max_line_length)
@appeltel
appeltel / pubsub.py
Last active May 5, 2024 09:40
asyncio pubsub example
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@Klerith
Klerith / pasos-node-ts-jest.md
Created August 19, 2023 18:35
Note + TypeScript + Jest = Testing

Pasos para configurar Jest con TypeScript, en Node

Documentación oficial sobre Jest

  1. Instalaciones de desarrollo (super test es útil para probar Express)
npm install -D jest @types/jest ts-jest supertest
For a more organised and more update list please visit https://github.com/RayZz-/LCU-Arguments
This list will no longer be updated please refer to the repo linked above
These are known command line arguments for the LCU(including helper) some maybe outdated
or overtime may become outdated or some information maybe incorrect
if you would like to contribute please comment with updated information.
Usage example:
--app-name=kappa
@samanzamani
samanzamani / gist:7ab3046ae1f94348d852bde959349f92
Last active May 5, 2024 09:35
لیست کامل تمام شهرها و استان های ایران
[
{
"province": "اردبیل",
"cities": [
"اردبیل",
"اصلاندوز",
"آبی بیگلو",
"بیله سوار",
"پارس آباد",
"تازه کند",
@jahe
jahe / jpa-cheatsheet.java
Last active May 5, 2024 09:34
JPA Cheatsheet
/*
JPA (Java Persistence API)
Transaction Management with an Entity-Mananger:
---
entityManager.getTransaction().begin();
entityManager.persist(<some-entity>);
entityManager.getTransaction().commit();
entityManager.clear();
@deefdragon
deefdragon / migrate.configmap.yaml
Last active May 5, 2024 09:33
Migrating Kubernetes PVC/PVs from one storage class to another
apiVersion: v1
kind: ConfigMap
metadata:
# any name can be used; Velero uses the labels (below)
# to identify it rather than the name
name: change-storage-class-config
# must be in the velero namespace
namespace: velero
# the below labels should be used verbatim in your
# ConfigMap.
@acidtib
acidtib / readme.md
Created August 28, 2023 17:56
kamal + github actions

Example of Kamal deployment from Github Actions.

Add your applications .env variables to the Github repo as a repository secret, you can find this under the repo settings => secrets and variables => actions

https://github.com/username/repo_name/settings/secrets/actions

you are going to need an ssh private key that your deployment server is aware of (add public key to servers .ssh/authorized_keys) and add the ssh private key as a repo secret

create action workflows