Skip to content

Instantly share code, notes, and snippets.

@flowpoint
flowpoint / orbitdbexample.go
Created November 8, 2022 17:45
dirty example to use go-orbitdb eventlog
package main
// dirty example to use go-orbitdb eventlog
import (
"time"
"context"
"fmt"
"io"
"os"
@flowpoint
flowpoint / gist:08e76e9a90544009b298e5bea9219236
Created October 10, 2022 16:05
pyarrow_big_string_patch
diff --git a/cpp/src/arrow/compute/kernels/row_encoder.cc b/cpp/src/arrow/compute/kernels/row_encoder.cc
index f553708cc..6a0862c0b 100644
--- a/cpp/src/arrow/compute/kernels/row_encoder.cc
+++ b/cpp/src/arrow/compute/kernels/row_encoder.cc
@@ -63,13 +63,13 @@ Status KeyEncoder::DecodeNulls(MemoryPool* pool, int32_t length, uint8_t** encod
}
void BooleanKeyEncoder::AddLength(const ExecValue&, int64_t batch_length,
- int32_t* lengths) {
+ int64_t* lengths) {
@flowpoint
flowpoint / wrapper_class.py
Last active April 14, 2019 16:08
python wrapper class
class wrapper_class:
def __init__(self, val, *args, **kwargs):
if callable(val):
self.val = val(*args,**kwargs)
else:
self.val = val
def __getattr__(self,*args, **kwargs):
return self.val.__getattribute__(*args, **kwargs)
@flowpoint
flowpoint / mmverify.py
Created March 27, 2019 09:54
raph leviens mmverify metamath python proof checker
#!/usr/bin/env python3
# mmverify.py -- Proof verifier for the Metamath language
# Copyright (C) 2002 Raph Levien raph (at) acm (dot) org
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License
# To run the program, type
# $ python3 mmverify.py < set.mm 2> set.log
# and set.log will have the verification results.
@flowpoint
flowpoint / gist:ad9839ca9b883a107af619d9bbddc058
Created November 25, 2018 22:26
ft232h breakout debug libftdi note
ft232h ftdi_usb_get_string doesnt work with libftdi if the manufacturer serial or product code in eeprom is not ascii
therefore the python swig binding ftdi1 usbget_strings doesnt work either
and the adafruit_gpio.FT232H
todo:
fix in libftdi
or reprogra ft232h eeprom
@flowpoint
flowpoint / linear_list_remove.py
Created October 23, 2018 09:40
linear time list remove python, no correctness guarantee
def linear_list_remove(target, elems_to_remove):
''' careful, this is not always correct because hash collisions
removes list elements from list in O(1) '''
mp = {}
for i in elems_to_remove:
mp[i] = 1 #remove linebreak
ret_list = []
for i in target:
@flowpoint
flowpoint / causal_keras_error.py
Created October 10, 2018 11:33
causal conv eager issue keras tensorflow
import tensorflow as tf
#import keras # works, but wants tf.contrib.eager.Variable for eager execution somewhere
from tensorflow import keras # <- errors on padding='causal'
import numpy as np
#tf.enable_eager_execution() #
data = np.random.random([1,1,256])
leaky_relu = tf.nn.leaky_relu
@flowpoint
flowpoint / gist:f04e845838db6a9ab0cbbe68ad3ba5a3
Last active February 1, 2018 14:49
tensorflow atrous conv1d
def atrous_conv1d(value, filters, rate, padding, name=None):
'''wrapper for tf.nn.convolution to atrous_conv1d
lets you choose the filters
usage:
b = tf.placeholder(shape=(None, 1, 4096,1), dtype=tf.float32)
atrous_conv1d(b, filters=tf.ones((1, 4096, 1)),rate=2, padding='VALID')
b = tf.placeholder(shape=(None, 4096), dtype=tf.float32)
atrous_conv1d(b, filters=tf.ones((1, 4096, 1)),rate=2, padding='VALID')
@flowpoint
flowpoint / main.elm
Last active September 28, 2017 14:05
elm template
import Html exposing(..)
main =
Html.program
{ init = init,
view = view,
update = update,
subscriptions = subscriptions
}
@flowpoint
flowpoint / ipfs_remove_all_pins_script.sh
Created September 16, 2017 14:49
ipfs_remove_all_pins_script
#!/bin/bash
#delete all ipfs pins script
#dont forget chmod
a=`ipfs pin ls --type=recursive | awk '{print $1;}' `
for pins in $a
do