Skip to content

Instantly share code, notes, and snippets.

View Bad-ptr's full-sized avatar

Constantin Kulikov Bad-ptr

View GitHub Profile
@Bad-ptr
Bad-ptr / make_gitignore.sh
Last active December 19, 2015 23:59
Construct .gitignore file
#!/bin/bash
INCLUDE="Emacs vim Archives CVS SVN Mercurial Tags OSX Windows Linux C Go"
EXCLUDE="Bancha Objective-C"
if [ -d "./gitignore" ]; then
cd "./gitignore"
echo "-> git pull"
@Bad-ptr
Bad-ptr / startkillemacsd.sh
Last active December 29, 2015 06:19
start or kill emacs daemon
#!/bin/bash
# https://gist.github.com/Bad-ptr/7628186
DAEMON='server';
if [ -n "$1" ];
then
DAEMON="$1"
fi
@Bad-ptr
Bad-ptr / company-minibuffer.el
Last active May 2, 2020 11:14
Allow company-mode in minibuffer.
(with-eval-after-load "company-autoloads"
(global-company-mode 1)
(setq company-tooltip-limit 20
company-minimum-prefix-length 1
company-echo-delay 0
company-begin-commands '(self-insert-command
c-electric-lt-gt c-electric-colon
completion-separator-self-insert-command)
company-idle-delay 0.2
@Bad-ptr
Bad-ptr / go-mode-indentation-enhance-v1.el
Last active January 1, 2016 11:49
Trying to fix go-mode indentation issues.
(with-eval-after-load "go-mode"
(defconst go-dangling-operators-regexp "[^-]-\\|[^+]\\+\\|[/,*&><.=|^%]")
(defun go--find-indent-info-for-current-line (maxpoint)
(let ((start-pos (progn
(beginning-of-line)
(skip-chars-forward "\s\t")
(current-column)))
(start-type :start)
prev-start-pos prev-ending ending eq-l
@Bad-ptr
Bad-ptr / company-go.el
Created February 21, 2014 23:03
company-go with templates and signature in tooltip
;;; company-go.el --- company-mode backend for Go (using gocode)
;;; Code:
(eval-when-compile
(require 'cl)
(require 'company))
(defun company-go--invoke-autocomplete ()
(let ((temp-buffer (generate-new-buffer "*gocode*")))
@Bad-ptr
Bad-ptr / .bashrc
Created October 9, 2014 17:10
Must have.
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
@Bad-ptr
Bad-ptr / on_ac_power.sh
Created October 14, 2014 17:45
Check if we on ac power or not.
#!/bin/sh
#
# Test if the computer is running on line power
# Exit status:
# - 0 (true) System is on AC power
# - 1 (false) System is not on AC power
#
# NOTE: Batteries are not good indicators unless we also check their type,
# as some peripherals have batteries.
#
@Bad-ptr
Bad-ptr / uncapslock.py
Created October 26, 2014 14:39
python, libx11, switch off caps
#!/usr/bin/env python
from ctypes import *
X11 = cdll.LoadLibrary("libX11.so.6")
display = X11.XOpenDisplay(None)
X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2), c_uint(0))
X11.XCloseDisplay(display)
@Bad-ptr
Bad-ptr / compile_keymap.sh
Created October 26, 2014 14:46
compile xkb keymap
#! /bin/bash
xkbcomp -I$HOME/.xkb/ ~/.xkb/keymap/mykbd $DISPLAY &
@Bad-ptr
Bad-ptr / .vimrc
Last active March 4, 2020 13:50
Vim settings, compatible with vim.tiny
scriptencoding utf-8
set nocompatible
"Basic Settings {{{1
" Encoding {{{2
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
" Text Wrapping {{{2