Skip to content

Instantly share code, notes, and snippets.

@gentoo90
gentoo90 / rxjs-file-reader.ts
Created October 5, 2023 13:49
rxjs-file-reader.ts
import { Observable, Subscriber } from 'rxjs';
function readAs(
blob: Blob,
as: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text',
encoding?: string
): Observable<any> {
return new Observable(
(subscriber: Subscriber<string | ArrayBuffer | null>) => {
const fileReader = new FileReader();
@gentoo90
gentoo90 / caja-maestral.py
Last active November 7, 2022 17:26
Maestral plugin for caja
'''
Maestral (Dropbox open source client) integration for Caja (MATE file manager)
1) Put it into ~/.local/share/caja-python/extensions
2) Install python-caja:
$ sudo apt-get install python-caja
To see caja output in terminal:
$ caja -q && caja
'''
from os import path
@gentoo90
gentoo90 / angular-extend-provided.ts
Last active October 5, 2023 13:54
How to extend provided value in Angular DI
/**
* Nice little trick that allows to provide some settings in the parent
* and then override some of them in the child
*/
import { Component, Inject, InjectionToken, NgModule, SkipSelf } from '@angular/core';
import { defaults } from 'lodash-es';
export const SETTINGS_TOKEN = new InjectionToken('SETTINGS_TOKEN');
@Component({
@gentoo90
gentoo90 / .block
Last active July 23, 2019 10:12 — forked from akollegger/.block
Honeycomb Bloom Chart
license: mit
--- sqlite_master.sql 2016-08-28 10:01:23.227790106 +0300
+++ sqlite_named_enums.sql 2016-08-28 09:26:14.223932432 +0300
@@ -60,7 +60,7 @@
build_id INTEGER NOT NULL,
url VARCHAR(2048),
PRIMARY KEY (id),
- CHECK (status IN ('bad', 'receiving', 'reviewing', 'processing', 'good')),
+ CONSTRAINT release_states CHECK (status IN ('bad', 'receiving', 'reviewing', 'processing', 'good')),
FOREIGN KEY(build_id) REFERENCES build (id)
);
set DEP_OPENSSL_INCLUDE=C:\OpenSSL-Win64\include
set OPENSSL_INCLUDE_DIR=C:\OpenSSL-Win64\include
set OPENSSL_LIBS=ssleay32MT:libeay32MT
set OPENSSL_LIB_DIR=C:\OpenSSL-Win64\lib\VC
path C:\OpenSSL-Win64\bin;%PATH%
cargo test
/***************
* pointers.js *
***************
*
* You! How are you still alive?
*
* Well, no matter. Good luck getting through this
* maze of rooms - you'll never see me or the Algorithm again!
*/
/*
* robotMaze.js
*
* The blue key is inside a labyrinth, and extracting
* it will not be easy.
*
* It's a good thing that you're a AI expert, or
* we would have to leave empty-handed.
*/
@gentoo90
gentoo90 / caja-syncthing.py
Created December 5, 2014 22:16
Syncthing integration for Caja
'''
Syncthing integration for Caja (MATE file manager)
1) Put it into ~/.local/share/caja-python/extensions
2) Install python-caja:
# sudo apt-get install python-caja
3) Install python-requests:
$ sudo add-apt-repository ppa:deluge-team/ppa
@gentoo90
gentoo90 / embed_kernel_cb.py
Created September 21, 2014 08:23
embed ipython kernel and automatically open console
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
Embed IPython kernel and automatically open console
connected to it.
"""
import os
from zmq.eventloop.ioloop import IOLoop
import IPython