Skip to content

Instantly share code, notes, and snippets.

@dovideh
dovideh / minswap2.py
Last active January 12, 2020 12:00
min_swp2
def minimumSwaps(arr):
swp = 0
n = len(arr)
for i,j in enumerate(arr):
if(j != i+1):
source_idx = arr.index(i+1)
destination_idx = arr.index(j)
swp += 1
arr[destination_idx], arr[source_idx] = arr[source_idx], arr[destination_idx]
#!/bin/python
import math
import os
import random
import re
import sys
# Complete the minimumSwaps function below.
def minimumSwaps(arr):
@dovideh
dovideh / hacker-rank-min-swap-dict.py
Last active January 14, 2020 18:22
Minimum Swaps 2 - HR
#!/bin/python
import math
import os
import random
import re
import sys
# Complete the minimumSwaps function below.
def minimumSwaps(arr):
@dovideh
dovideh / example.kshrc
Created May 9, 2020 19:45 — forked from Head-on-a-Stick/example.kshrc
Sample .kshrc
# This file contains examples of some of the things you may want to
# include in a user startup file.
# handle bash/zsh SHLVL variable
(( SHLVL++ ))
# skip this setup for non-interactive shells
[[ -o interactive && -t 0 ]] || return
# disable core dumps
@dovideh
dovideh / xfdesktop.patch
Created November 28, 2020 06:09
Right click behave like windows / osx - show menu on GDK_BUTTON_RELEASE
--- src.orig/xfdesktop/src/xfce-desktop.c 2020-11-28 00:28:13.965018899 +0200
+++ src/xfdesktop/src/xfce-desktop.c 2020-11-28 08:04:35.265630011 +0200
@@ -1306,7 +1306,7 @@
}
static gboolean
-xfce_desktop_button_press_event(GtkWidget *w,
+xfce_desktop_button_release_event(GtkWidget *w,
GdkEventButton *evt)
{