Skip to content

Instantly share code, notes, and snippets.

View kdarkhan's full-sized avatar
🚀

Darkhan Kubigenov kdarkhan

🚀
View GitHub Profile
View obinskit-color-palette.md

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'
View convert-snipmate-to-ultisnips.sh
#!/bin/sh
set -e
# Download currently removed script for converting snipmate snippets
# into UltiSnips format
curl -o convert_snipmate_snippets.py https://raw.githubusercontent.com/SirVer/ultisnips/bca51cb4037b587a6c71b35f24ae200b92120248/utils/convert_snipmate_snippets.py
for filename in snippets/{,**/}*.snippets; do
echo "converting file $filename"
@kdarkhan
kdarkhan / capslock.ahk
Created March 22, 2020 17:17 — forked from scottming/capslock.ahk
; Autohotkey Capslock Remapping Script
View capslock.ahk
; 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
@kdarkhan
kdarkhan / monitor_hotplug.sh
Created June 1, 2018 05:49
HiDPI display with not so HiDPI external monitor
View monitor_hotplug.sh
export DISPLAY=:0
disp=eDP-1
disp2=HDMI-1
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
kdarkhan / .spacemacs
Created May 25, 2018 19:10
Spacemacs config
View .spacemacs
;; -*- 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."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@kdarkhan
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 https://github.com/kdarkhan/chess-count
View MoveCountSolver.scala
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
View set_brightness.sh
#!/usr/bin/bash
if [ "$EUID" -ne 0 ]
then echo "The script should be run under root"
exit
fi
path=/sys/class/backlight/intel_backlight/
read -r currentBrightness < "$path"/actual_brightness
read -r maxBrightness < "$path"/max_brightness
@kdarkhan
kdarkhan / Controller.scala
Last active August 29, 2015 14:24
Compute sha1 checksum of file in Play framework 2.4.x during upload
View Controller.scala
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))
Iteratee.fold[Array[Byte],
(MessageDigest, File, FileOutputStream)](initialState) {
case ((md, file, os), data) =>
md.update(data)