Skip to content

Instantly share code, notes, and snippets.

View kdarkhan's full-sized avatar

Darkhan Kubigenov kdarkhan

View GitHub Profile
kdarkhan / Controller.scala
Last active August 29, 2015 14:24
Compute sha1 checksum of file in Play framework 2.4.x during upload
val uploadDir = "/tmp/uploads/"
def uploadParted = Action.async(parse.multipartFormData(
handleFilePart {
case FileInfo(partName, fileName, contentType) =>
val tempFile = File.createTempFile("file_prefix", "")
val initialState = (MessageDigest.getInstance("SHA-1"), tempFile, new FileOutputStream(tempFile))
(MessageDigest, File, FileOutputStream)](initialState) {
case ((md, file, os), data) =>
if [ "$EUID" -ne 0 ]
then echo "The script should be run under root"
read -r currentBrightness < "$path"/actual_brightness
read -r maxBrightness < "$path"/max_brightness
kdarkhan / MoveCountSolver.scala
Created October 3, 2017 12:52
Counting chess combinations where no piece is attacking another piece. The whole project is located at
package com.darkhan.chess
import scala.annotation.tailrec
case class MoveCountSolver(board: Board) {
def solve(pieces: List[Piece]): Int = {
// a map from piece to count of how many times that piece appears in the original list
// this is needed to avoid double counting when there are multiple versions of the same piece
// such as two queens
kdarkhan / .spacemacs
Created May 25, 2018 19:10
Spacemacs config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
kdarkhan /
Created June 1, 2018 05:49
HiDPI display with not so HiDPI external monitor
export DISPLAY=:0
function connect(){
# echo 'connect'
# sleep 2
xrandr > /dev/null
# xrandr --output "$disp2" --right-of "$disp"
# xrandr --output "$disp" --mode 2048x1152 --dpi 151 --output "$disp2" --auto --right-of "$disp"
kdarkhan / capslock.ahk
Created March 22, 2020 17:17 — forked from scottming/capslock.ahk
; Autohotkey Capslock Remapping Script
; Autohotkey Capslock Remapping Script
; - Deactivates capslock for normal (accidental) use.
; - Hold Capslock and drag anywhere in a window to move it (not just the title bar).
; - Access the following functions when pressing Capslock:
;Cursor keys - h, j, k, l
;Home,End - N, ;
;Page up,down - - =
;Esc - CapsLock only
;CapsLock - Space
set -e
# Download currently removed script for converting snipmate snippets
# into UltiSnips format
curl -o
for filename in snippets/{,**/}*.snippets; do
echo "converting file $filename"

obinskit provides only these colors in their palette.

Most of the colors have high intensity values probably because the flicker with lower intensity values.

  • '#0000CC'
  • '#0000FF'
  • '#0033CC'
  • '#0033FF'
  • '#0066CC'
  • '#0066FF'
  • '#0099CC'
  • '#0099FF'