Skip to content

Instantly share code, notes, and snippets.

@krizajb
krizajb / cpc_bug.java
Last active Mar 17, 2020
CPC business process bug
View cpc_bug.java
// note: all steps check if the logged in user is the CPC_AUTHORITY (Role)
// was the chief selected (via dialog)
if (null != this.selectedChief) {
// store selected chief id to the application
this.application.setChiefId(this.selectedChief.getId());
// remove chiefs if from the visited id list (so the chief sees the application as "new" in the list)
this.application.removeVisitedId(this.selectedChief.getId());
// is registrar only changing the chief selection
View custom-filter.js
function filterList(componentName, label, filter) {
let component = PF(componentName),
itemLabel = label.toLocaleLowerCase(),
item = $(component.items)
.filter(function () {
return $(this).data('label').toString().toLocaleLowerCase() === itemLabel;
})
.first();
if (item === undefined) {
@krizajb
krizajb / remap-win-key.ahk
Last active Apr 5, 2020
Authotkey script for remapping windows (super) key to Shift+Alt+Space and windows key + h to minimize the current window, windows + move.
View remap-win-key.ahk
; Remap windows key + h to minimize the current window
#h::
WinMinimize A
return
; Disable the keyboard layout switcher
Ctrl & Shift::
return
; Remap windows key to the launcher
View toggle_touchpad.py
#!/usr/bin/python2
# -*- coding: utf-8 -*-
'''Program to toggle Touchpad Enable to Disable or vice-versa.'''
import commands
import re
def current_id():
""" Search through the output of xinput and find the line that has the
@krizajb
krizajb / fan-control.bat
Created Jul 20, 2019
Restarts HWiNFO instance end re-disables dGPU
View fan-control.bat
@echo off
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
start /min cmd /c taskkill /f /im HWiNFO64.exe
start /min /wait cmd /c D:\Documents\Qord\dell-xps\devcon.exe enable "PCI\VEN_10DE&DEV_1C8C&SUBSYS_087C1028&REV_A1"
start /min /wait cmd /c D:\Documents\Qord\dell-xps\devcon.exe disable "PCI\VEN_10DE&DEV_1C8C&SUBSYS_087C1028&REV_A1"
start /min cmd /c "C:\Program Files\HWiNFO64\HWiNFO64.exe"
@krizajb
krizajb / gmail-sidebar-toggle
Last active Aug 8, 2019
Toggle gmail left sidebar with escape key
View gmail-sidebar-toggle
// ==UserScript==
// @name Toggle left sidebar
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Toggles left gmail sidebar on "esc" keypress.
// @author blaz.krizaj@gmail.com
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @match *://mail.google.com/*
// @grant none
// ==/UserScript==
@krizajb
krizajb / synology-diskstation-git-setup.md
Last active May 3, 2018 — forked from walkerjeffd/Synology-Diskstation-Git.md
Instructions for setting up git server on Synology Diskstation
View synology-diskstation-git-setup.md

Configure Synology NAS as Git Server

Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

Set Up User and Folder

  • Create user gituser via Diskstation interface (with File Station and WebDAV privilages)
  • Add new shared folder called git (located at /volume1/git) with read/write access for gituser and admin. This folder will hold all the repos.
  • Install Git Server package via Diskstation
@krizajb
krizajb / PGraphicsJava2DJustify.java
Last active Mar 6, 2018
Adds option to Justify text aligenment in processing.
View PGraphicsJava2DJustify.java
import processing.core.*;
public class PGraphicsJava2DJustify extends PGraphicsJava2D {
public static int JUSTIFY = 4;
static protected void showTextFontException(String method) {
throw new RuntimeException("Use textFont() before " + method + "()");
}
@krizajb
krizajb / measureString.as
Last active Jul 19, 2019
Messure text/string in textfield
View measureString.as
public static function measureString(str:String, format:TextFormat) : Number {
var textField:TextField = new TextField();
textField.autoSize = TextFieldAutoSize.LEFT; // adjust appropriately
textField.defaultTextFormat = format;
textField.text = str;
return textField.textWidth;
}
You can’t perform that action at this time.