Skip to content

Instantly share code, notes, and snippets.

View Ekliptor's full-sized avatar

Ekliptor

View GitHub Profile
@macx
macx / README.md
Last active November 17, 2025 17:31
Switch from classic yarn to modern yarn

Switch from classic yarn to modern yarn

Why

Previously, yarn was installed globally via npm i -g yarn or brew install yarn/choco install yarn and every project you are working on uses it to handle it's dependencies. yarn itself will installed in version 1, which is called "classic". If you update yarn in the version 1 branch over time, old projects could become not compatible anymore.

Here is "Modern yarn" kicking in, because it will be installed not globally, it will installed per project with corepack which is a tool from Node to handle different versions. Modern yarn starts from version 2 and is now 4.

Installed per project basis, you can operate your projects with different yarn versions independently – a huge benefit in terms of compatibiliy. But in order to so, you have to remove yarn globally and reinstall it with corepack.

@ultrox
ultrox / useMemoUseCallback.js
Last active August 16, 2024 23:08
This is implementation of useMemo and useCallback directly from facebook/react, with some flow types removed and minor code changes.
/*type Hook = {|
memoizedState: any,
queue: UpdateQueue < any > | null,
next: Hook | null,
|};
*/
// Whether the work-in-progress hook is a re-rendered hook
let numberOfReRenders/*: number */= 0;
let isReRender/*: boolean */= false;
let firstWorkInProgressHook /*Hook | null */= null;
@inthestatic
inthestatic / delta-hedge.py
Last active January 22, 2023 11:19
Minimalist delta hedging script for Deribit
import requests
import json
from time import sleep
from datetime import datetime
#settings
delta_band = .1 # how far can account delta drift from 0 either up or down
repeat_seconds = 5 # how often should the script loop to check for delta
delta_bias = 1 # 0=no bias, >0 positive price bias ok with additional BTC exposure
@bitjson
bitjson / 0_cashchannels.md
Last active August 18, 2025 18:41
CashChannels: Recurring Payments for Bitcoin Cash
@abrkn
abrkn / drivechain.ai.md
Created October 22, 2018 10:42
Drivechain.ai

Drivechain.ai

The following toolkit makes getting started with Drivechain TestDrive easier and more fun!

Services

@blaskovicz
blaskovicz / template.html
Created June 30, 2017 18:01
Golang template features (nested variables, range over array, index into map, conditionals)
<div class="levels">
{{ $groups := .LevelGroups }}
{{ $groupedLevels := .Levels }}
{{ $completeLevels := .CompleteLevels }}
{{ if $groupedLevels }}
{{ range $group := $groups }}
<div class="intro"><h2>{{$group}}</h2></div>
{{ range index $groupedLevels $group }}
<a href="/level/{{.Number}}" class="{{if index $completeLevels .Number}}complete{{end}}">
<span class="level">{{.Number}} </span>
@heaversm
heaversm / twilio-transcription-back.js
Last active January 14, 2023 11:04
Twilio Call Recording Transcriptions With Google Web Speech API
//node vars
const express = require('express')
const twilio = require('twilio')
const request = require('request')
//twilio vars
const accountSid = '###' //your twilio account SID
const authToken = "###" //your twilio auth token
const client = require('twilio')(accountSid, authToken)
const baseURL = 'https://api.twilio.com/2010-04-01/Accounts/[YOUR_ACCOUNT_HERE]/Recordings/'
@bUxEE
bUxEE / find_string.php
Last active July 23, 2025 01:02
find string in file (search in directory and subdirectories) php
<?php
$string = 'stringToSearch';
$dir = new RecursiveDirectoryIterator('folder');
foreach (new RecursiveIteratorIterator($dir) as $filename => $file) {
//$thename = $file->getFilename(); //uncomment this line and next to print names of all files scanned
//echo $thename.'<br />';
$content = file_get_contents($file->getPathname());
if (strpos($content, $string) !== false) {
@CMCDragonkai
CMCDragonkai / nginx_fastcgi_errors.md
Last active April 3, 2025 23:28
NGINX: Common FastCGI Errors involving PHP-FPM

Common FastCGI Errors involving PHP-FPM

  1. 504 Gateway Timeout

    upstream timed out (110: Connection timed out) while reading response header from upstream
    

Means NGINX timed out reading the HTTP response header from upstream. This

@michaljemala
michaljemala / tls-client.go
Last active September 5, 2025 07:30
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)