Skip to content

Instantly share code, notes, and snippets.

View Gozala's full-sized avatar
😱
Oh well

Irakli Gozalishvili Gozala

😱
Oh well
View GitHub Profile
@Gozala
Gozala / git-gpg.md
Created April 12, 2016 21:18 — forked from bcomnes/git-gpg.md
my version of gpg on the mac
  1. brew install gnupg21, pinentry-mac (this includes gpg-agent and pinentry)
  2. Generate a key: $ gpg --gen-key
  3. Take the defaults. Whatevs
  4. Tell gpg-agent to use pinentry-mac:
$ vim ~/.gnupg/gpg-agent.conf 
"use strict";
const { addObserver, notifyObservers } = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
const { getEnumerator } = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
const isBrowser = window => {
try {
return window.document.documentElement.getAttribute("windowtype") === "navigator:browser";
1) ipfs --upgrade-cidv0-in-output=true add --chunker=rabin-262141 --trickle=false --raw-leaves=false --cid-version=0 ../testdata/large_repeat_1GiB.zst
2) ipfs add --chunker=rabin-262141 --trickle=false --raw-leaves=false --cid-version=1 ../testdata/large_repeat_1GiB.zst
3) ipfs --upgrade-cidv0-in-output=true add --chunker=rabin-262141 --trickle=false --raw-leaves=true --cid-version=0 ../testdata/large_repeat_1GiB.zst
4) ipfs add --chunker=rabin-262141 --trickle=false --raw-leaves=true --cid-version=1 ../testdata/large_repeat_1GiB.zst
5) ipfs --upgrade-cidv0-in-output=true add --chunker=size-65535 --trickle=true --raw-leaves=false --cid-version=0 ../testdata/large_repeat_1GiB.zst
6) ipfs add --chunker=size-65535 --trickle=true --raw-leaves=false --cid-version=1 ../testdata/large_repeat_1GiB.zst
7) jsipfs add --chunker=size-65535 --trickle=true --raw-leaves=false --cid-version=1 ../testdata/large_repeat_1GiB.zst
8) ipfs --upgrade-cidv0-in-output=true add --chunker=size-262144 --trickle=true --raw-leaves=false -
@Gozala
Gozala / unixfs.ts
Created January 31, 2022 19:59
Attempt to define more clearly unixfs encoding
import type { CID } from 'multiformats'
/**
* Logical representation of a raw chunk of a file.
*
* TODO: Clarify when represenation is used instead of `FileChunk`
* representation.
*/
export interface Raw extends PBNode {
Data: ByteView<{
@Gozala
Gozala / api.v0.ts
Last active January 6, 2022 06:42
Sketch of unixfs-importer API
import type { CID} from "multiformats"
import { Mtime } from "ipfs-unixfs"
export interface Lib {
/**
* Creates a directory importer that can be used to build up directory of
* files. It takes an optional queuing strategy parameter that can be used
* to specify how how many blocks can be queue internally before backpressure
* is applied and writer is blocked. This allows users to specify how much
import { loop, recur } from './loop.js'
export const factorial = (n) => loop((n, acc) => n <= 1 ? acc : recur(n - 1, n * acc), n, 1)
@Gozala
Gozala / example.js
Created January 29, 2012 03:46
Workaround for lack of "tail call optimization" in JS
// Lack of tail call optimization in JS
var sum = function(x, y) {
return y > 0 ? sum(x + 1, y - 1) :
y < 0 ? sum(x - 1, y + 1) :
x
}
sum(20, 100000) // => RangeError: Maximum call stack size exceeded
// Using workaround
@Gozala
Gozala / go.js
Created October 31, 2013 00:08
Go routines for JS
// Utility function for detecting generators.
let isGenerator = x => {
return Function.isGenerator &&
Function.isGenerator.call(x)
}
// Data type represents channel into which values
// can be `put`, or `received` from. Channel is
// very much like queue where reads and writes are
// synchronized via continuation passing.
module Focus exposing (Model, init, update, onFocus, onBlur, focus, blur) where
import Ref
import Native.Focus
import Html
import Html.Attributes
import Html.Events
type alias Model =
{ ref: Ref.Ref
@Gozala
Gozala / Readme.md
Last active January 12, 2021 13:52
Range hilighting code by wrapping text nodes of the range & replacing images.

Highlight Selection Ranges

Code here takes a DOM Selection Range instance and starts traversing a DOM starting from startContainer up to endContainer and wraps Text elements with elements that have semi-transparent background & swaps img elements with clones that are styled to have semi-transparent yellow overlay.

Issues

  • Only handles selecting text and images & would not cover divs with backgrounds for instance.