14
Jul
2021

Spotify dbus

14 Jul 2021
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous

// Scale. add force-device param
spotify --force-device-scale-factor=1.5 %U
6
Jul
2021

pprof

06 Jul 2021

Generate reports in app with code:

CPU

cpuFile, err := os.Create("/tmp/cpuProfile.out")
if err != nil {
    fmt.Println(err)
	return
}
pprof.StartCPUProfile(cpuFile)
defer pprof.StopCPUProfile()
go
23
Apr
2021

Mutex example

23 Apr 2021

1.Without

package main
import "fmt"

var counter int = 0             
func main() {

    ch := make(chan bool)        
    for i := 1; i < 5; i++{
        go work(i, ch)
    }
go
28
Oct
2020

Find and replace

28 Oct 2020
Find:       (:update\s.*)(_new)
Replace:    $1

Given text:

foo:update example_new
foo:update word_new
foo:update also_new

Output:

15
Apr
2020

Bulk Export

15 Apr 2020

SQL-Insert-Statements-Bulk-100per.sql.groovy

SEP = ", "
QUOTE     = "\'"
NEWLINE   = System.getProperty("line.separator")

KEYWORDS_LOWERCASE = com.intellij.database.util.DbSqlUtil.areKeywordsLowerCase(PROJECT)
KW_INSERT_INTO = KEYWORDS_LOWERCASE ? "insert into " : "INSERT INTO "
KW_VALUES = KEYWORDS_LOWERCASE ? "values" : "VALUES"
KW_NULL = KEYWORDS_LOWERCASE ? "null" : "NULL"

OUT.append(KW_INSERT_INTO)
22
Nov
2019

KDE Dive In

22 Nov 2019

Apps

PHS 2019.1.4 
DGP 2019.2.6 custom JDK
DGP 2019.3 + plugin Choose Runtime + 8u212-linux-x64-b1596.1

latte launcher

subl ~/.config/kwinrc

[ModifierOnlyShortcuts]
Meta=org.kde.lattedock,/Latte,org.kde.LatteDock,activateLauncherMenu
17
Jun
2019

Dock station D3100

17 Jun 2019

Fix slowing CPU

sudo nano /etc/X11/xorg.conf.d/20-intel.conf 

Section "Device"
  Identifier "Intel Graphics"
  Driver "Intel"
  Option "AccelMethod" "sna" 
  Option "TearFree" "true"
  Option "TripleBuffer" "true"
  Option "MigrationHeuristic" "greedy"
  Option "Tiling" "true"
23
Mar
2019

search lost info

23 Mar 2019
git reflog --all | grep something
git fsck --full --no-reflogs --unreachable --lost-found | grep commit | cut -d\  -f3 | xargs -n 1 git log -n 1 --pretty=oneline > .git/lost-found.txt
5
Feb
2019

regex

05 Feb 2019

select column

^.{12}\K(.){10}
9
Nov
2018

Ubuntu Dive In

09 Nov 2018

Frontend build

sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install gulp-cli -g

npm install
gulp all-build 

Switch language