Skip to content

Instantly share code, notes, and snippets.

View bushev's full-sized avatar

Yury Bushev bushev

View GitHub Profile
@bushev
bushev / script.js
Created March 19, 2020 19:50
Remove duplicated files from Moments (Synology NAS)
// Very fast-coded deduplication utility. It parses standard "Storage Analyzer" report and moves duplicated files to a separate folder.
// Requires "npm i csv-parse 'move-file"
'use strict';
const path = require('path')
const fs = require('fs')
const parse = require('csv-parse/lib/sync')
const moveFile = require('move-file');

Add method handleDroppedFile:

async handleDroppedFile(payload) {

  this.broker.emit('compressor.compressed', {
    id: payload.id,
    ...await this.compressFile(payload.filePath)
  });
}

Add handleEvent method:

handleEvent(payload, sender, event) {

  this.metadata.webContents.send(event, payload);
}

Subscribe on event emit in method serviceCreated:

import { Injectable } from '@angular/core';
import { ElectronService } from 'ngx-electron';
import * as _ from 'lodash';
@Injectable({
providedIn: 'root'
})
export class IPCService {
'use strict';
const { spawn } = require('threads');
const { ServiceBroker } = require('moleculer');
const ElectronService = require('./services/electron.service');
class Loader {
static get config() {
const {Service} = require('moleculer');
const {app, ipcMain} = require('electron');
class ElectronService extends Service {
constructor(broker) {
super(broker);
this.parseServiceSchema({
name: 'electron',
const { Service } = require('moleculer');
const compressFileHelper = require('../utils/compress-file');
class CompressorService extends Service {
constructor(broker) {
super(broker);
this.parseServiceSchema({
@bushev
bushev / INFO.md
Created February 5, 2018 13:15
NeDB - how to start
@bushev
bushev / index.js
Created January 31, 2018 11:07
Macbook power state alerting [Node.js]
'use strict';
const exec = require('child_process').exec;
const https = require('https');
const API_KEY = `*****`;
const PHONE_NUMBER = `7920*****`;
let state = 'Unknown';
@bushev
bushev / ssh-tunnel-ios.md
Last active September 23, 2022 10:39
How to hide IP address without of VPN on iOS for free

In order to tunnel all iOS Internet traffic using SSH:

  1. Get this app: SSHTunnel
  2. Create a tunnel with type "Dynamic" & connect.
  3. Click on the config.pac file to copy it to a clipboard.
  4. Go to Settings > General > Network > Wi-Fi and tap the blue arrow on the right side of the entry for your network. Scroll down to the "Proxy" section and tap "Auto". Paste URL to a pac file from a clipboard.
  5. Have a FUN!

See a detailed video: https://www.youtube.com/watch?v=8r0eEr36Dg4