Skip to content

Instantly share code, notes, and snippets.

@marcolarosa
marcolarosa / gist:58e0903aa5d42d0842a42f29c83bfa7e
Created November 3, 2021 22:56
Talking to Reva via node-cs3apis
import { GatewayAPIClient } from "@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_grpc_pb";
const {
AuthenticateRequest,
WhoAmIRequest,
} = require("@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_pb")
import {
ListStorageSpacesRequest,
} from "@cs3org/node-cs3apis/cs3/storage/provider/v1beta1/provider_api_pb";
function promisifyAll(client) {

Keybase proof

I hereby claim:

  • I am marcolarosa on github.
  • I am marcolarosa (https://keybase.io/marcolarosa) on keybase.
  • I have a public key ASCqfgWAPpHXE18dV1lsA7mr177-vHonanXD8Jel_oe5oQo

To claim this, I am signing this object:

@marcolarosa
marcolarosa / gist:e95df344552ea10a31775ea7f81e2c12
Created June 2, 2021 23:49
Fix split routing table on linux
#!/bin/bash
is_private_network() {
NETWORK=${1}
is_private=0
for i in $(seq 0 255); do
match=$(echo $NETWORK | grep "10.$i")
[[ ! -z $match ]] && is_private=1
@marcolarosa
marcolarosa / gist:f95e7873b747f1f051ee05daca97584d
Last active October 9, 2021 03:52
Converting an excel sheet to json using ExcelJS
import Exceljs from "exceljs";
import { groupBy, compact, isEmpty } from "lodash";
const workbookFile = '/path/to/your/excelSheet/xlsx';
const nameOfSheet = 'name of sheet in workbook';
let workbook = new Exceljs.Workbook();
await workbook.xlsx.readFile(workbookFile);
const sheet = workbook.getWorksheet(nameOfSheet);
{
"status": "extinct",
"code": "cmt",
"coords": ["-26.247", "27.942"],
"name": "Camtho",
"level": "language",
"url": "http://www.language-archives.org/language/cmt",
"glotto_id": "camt1236",
"glotto_family_id": "mixe1287",
"resources": {
@marcolarosa
marcolarosa / gist:20d75b000f2055e4fc8e176bbd5b5fe7
Last active February 7, 2018 21:49
Sample OAI record from ListRecords
<record xmlns="http://www.openarchives.org/OAI/2.0/">
<header>
<identifier>
oai:transnewguinea.org:wfg.366
</identifier>
<datestamp>
2016-12-05
</datestamp>
</header>
class date_cleanser:
def __init__(self):
# time formats we will try to clean
self.timeformats = [
"%Y-%m-%d", # 1976-01-01
"%Y %m %d", # 1976 01 01
"%d %B %Y", # 12 January 1997
"%B %Y", # February 1998
"%Y", # 2004
Tomcat context file
<Context docBase="/opt/solr/apache-solr-4.3.0/solr-4.3.0.war" debug="0" crossContext="false" >
<Environment name="solr/home" type="java.lang.String" value="/opt/solr/solr" override="true"/>
</Context>