Skip to content

Instantly share code, notes, and snippets.

View Ekliptor's full-sized avatar

Ekliptor

View GitHub Profile
@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 19, 2024 20:50
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 May 23, 2025 01:11
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@ksafranski
ksafranski / Common-Currency.json
Last active July 31, 2025 14:56
Common Currency Codes in JSON
{
"USD": {
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},