Skip to content

Instantly share code, notes, and snippets.

@sean-nicholas
sean-nicholas / scroll.py
Created April 23, 2020 20:20
Scroll virtual desktops in windows
from pynput import mouse
from pynput.keyboard import Key, Controller
import json
with open('config.json', 'r') as f:
config = json.load(f)
keyboard = Controller()
def on_scroll(x, y, dx, dy):
@sean-nicholas
sean-nicholas / dynamic_key.ts
Last active July 8, 2019 11:32
dynamic key
interface IdMappingDoc {
firstId: string,
secondId: string,
}
interface IdMappingConfig {
sourceIdField: 'firstId' | 'secondId'
targetIdField: 'firstId' | 'secondId'
}
@sean-nicholas
sean-nicholas / keyboard-switcher.sh
Last active April 14, 2019 15:06
keyboard switcher Argos Gnome Extension
#!/usr/bin/env bash
# Empty image that is used instead of the ✔. Needed for alignment.
EMPTY_IMAGE="image='iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=' imageWidth=15"
CODING_ICON="$EMPTY_IMAGE"
NORMAL_ICON="$EMPTY_IMAGE"
# You might need to change this line. It justs tests if keycode 34 is mapping to a braceleft which indicates that we are in coding keyboard mode.
if xmodmap -pke | grep -q "keycode 34.*braceleft"
then
@sean-nicholas
sean-nicholas / auto-logout.ts
Last active September 2, 2019 22:14
auto logout zone
import { Router } from '@angular/router';
import { AuthService } from './auth.service';
import { Injectable, NgZone } from '@angular/core';
import * as store from 'store';
const MINUTES_UNITL_AUTO_LOGOUT = 5 // in Minutes
const CHECK_INTERVALL = 1000 // in ms
const STORE_KEY = 'lastAction';
@Injectable()
@sean-nicholas
sean-nicholas / alterItems.js
Last active June 19, 2018 16:37
Example for a possible alterItems implementation
function alterItems(func) {
if (!func) {
func = () => { };
}
if (typeof func !== 'function') {
throw new errors.BadRequest('Function required. (alter)');
}
@sean-nicholas
sean-nicholas / frxau_data_3.ts
Created March 24, 2018 13:11
feathers-reactive with Angular Universal - data 3
import { Injectable, PLATFORM_ID, Inject } from '@angular/core'
import { isPlatformBrowser } from '@angular/common'
import { HttpClient, HttpHeaders } from '@angular/common/http'
import { rxUniversal } from '../../lib/rx-universal'
import feathers from '@feathersjs/feathers'
import rest from '@feathersjs/rest-client'
import socketio from '@feathersjs/socketio-client'
import * as rx from 'feathers-reactive'
import * as io from 'socket.io-client'
@sean-nicholas
sean-nicholas / frxau_data_2.ts
Created March 24, 2018 12:50
feathers-reactive with Angular Universal - data 2
import * as superagent from 'superagent'
@Injectable()
export class DataService {
constructor(
@Inject(PLATFORM_ID) private platformId: Object
) {
if (isPlatformBrowser(this.platformId)) {
const socket = io(this.BASE_URL)
this.app
@sean-nicholas
sean-nicholas / frxau_rx-universal.ts
Created March 24, 2018 12:41
feathers-reactive with Angular Universal - rx universal
import { Observable } from 'rxjs/Observable'
export function rxUniversal(options = {}) {
const mixin = function (service) {
const app = this
const serviceMixin = {
watch(watchOptions = {}) {
const methods = {}
@sean-nicholas
sean-nicholas / frxau_data_1.ts
Created March 24, 2018 12:20
feathers-reactive with Angular Universal - data 1
@Injectable()
export class DataService {
constructor(
) {
const socket = io(this.BASE_URL)
this.app
.configure(socketio(socket))
.configure(rx({ idField: '_id' }))
}
@sean-nicholas
sean-nicholas / frxau_init.js
Last active March 24, 2018 12:17
feathers-reactive with Angular Universal - init
import feathers from '@feathersjs/feathers'
import * as io from 'socket.io-client'
import socketio from '@feathersjs/socketio-client'
import * as rx from 'feathers-reactive'
const app = feathers()
const socket = io(BASE_URL)
app
.configure(socketio(socket))
.configure(rx({ idField: '_id' }))