This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# swapcaps.sh | |
#!/bin/sh | |
if [[ $(xmodmap -pk | grep Caps | awk '{print $1}') = 22 ]]; then | |
# already configured, do nothing. | |
exit 0 | |
fi | |
# remove special key lock and swap caps with backspace | |
xmodmap -e "remove Lock = Caps_Lock" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn unpack [alist] | |
(loop [accum [] | |
alist alist] | |
(if (empty? alist) | |
accum | |
(let [ff (first alist) | |
func (if (sequential? ff) | |
concat | |
conj)] | |
(recur (func accum ff) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun get-buffer-data () | |
(let (bounds) | |
(setq bounds | |
(if (and transient-mark-mode mark-active) | |
(cons (region-beginning) (region-end)) | |
(cons (point) (point-max)))) | |
(buffer-substring-no-properties (car bounds) | |
(cdr bounds)))) | |
(defun buffer-mode (&optional buffer-or-name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Если у вас есть две или более модели SearchIndex, у которых есть поле с одинаковым названием, то в конфиге эластика последний | |
# тип оверрайдит первый. | |
class PointIndex(indexes.SearchIndex, indexes.Indexable): | |
text = indexes.NgramField(document=True, use_template=True) | |
address = indexes.EdgeNgramField(model_attr='address') | |
def get_model(self): | |
return Point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sys | |
import logging | |
import atexit | |
import argparse | |
from pyVim import connect | |
from pyVmomi import vmodl, vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; The fist version. Tricky and workarounded. | |
;; you can test it on this: | |
;; var BITS = ( 29, 0, 63, 85, 34 ) | |
(defun bit-compact (start end) | |
(interactive "r") | |
(defun int-to-binary-string (i) | |
"convert an integer into it's binary representation in string format" |