Skip to content

Instantly share code, notes, and snippets.

@zarkone
zarkone / man.aio.c
Created December 16, 2012 08:33
My l6, not finished, speshl for Yura Shatilin, with love
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <aio.h>
#include <signal.h>
#define BUF_SIZE 20 /* Size of buffers for read operations */
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)
@zarkone
zarkone / monodevelop4-build.sh
Last active December 4, 2018 17:51 — forked from choffmeister/monodevelop4-build.sh
Install Monodevelop 4.0.4 on Ubuntu 12.04 LTS
#!/bin/bash
sudo apt-get install build-essential automake checkinstall intltool git
sudo apt-get install mono-complete gtk-sharp2 gnome-sharp2
git clone https://github.com/mono/mono-addins
cd mono-addins
./autogen.sh --prefix=/usr
make
sudo make install
@zarkone
zarkone / page-changer.js
Last active December 16, 2015 13:59
Simple page changing mechanizm, Vanilla JS http://vanilla-js.com/ Suitable for small single page applications.
/*
* Let's assume that <div> containers with text have class="page" and id=page name + "Text".
* And the menu <a> links-switchers have class "menuItem" and id=page name + "Item".
*
* This script applies class "active" to selected page by observing window.location.href,
* with "about" as default page.
*
* demo: http://audioservice.pro/
*
*
@zarkone
zarkone / 0_reuse_code.js
Created December 6, 2013 18:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
(ns lightusers.core
(:require [clojure.data.json :as json]
[clojure.pprint :refer [pprint]]))
(def json-pprint (comp pprint json/write-str))
(def input (json/read-str (slurp "example.json")))
(defn extract
([tweet paths] (extract tweet paths []))
;; (nyan-mode)
(diminish 'yas-minor-mode)
(diminish 'helm-mode)
(diminish 'company-mode)
(setq-default
mode-line-format
'(" "
(:eval
@zarkone
zarkone / .Xresources
Created June 19, 2016 07:56
mc & urxvt theme
Xft.dpi: 96
Xft.antialias: true
Xft.hinting: true
Xft.hintstyle: hintslight
XTerm.vt100.faceName: DejaVu Sans Mono
XTerm.vt100.faceSize: 10
XTerm.vt100.background: #000000
XTerm.vt100.foreground: #ffffff
XTerm.vt100.utf8Fonts: always
XTerm.vt100.utf8:always
@zarkone
zarkone / backlight.lisp
Created November 1, 2017 02:44
Backlight (brightness) control for stumpwm (using `sysfs`)
(defcommand set-backlight (level) ((:number "Set brightness level:"))
(with-open-file (sys-backlight-file "/sys/class/backlight/intel_backlight/brightness"
:direction :output :if-exists :overwrite)
(format sys-backlight-file "~a~%" (* 100 level))))
;; C-u [1-9] changes level
(defvar *brightness-map* nil)
(setf *brightness-map*
(let ((b (make-sparse-keymap)))
(loop for level from 1 below 10 by 1 do
(defun should-collapse-p ()
(string-match-p "\s-*(def.*"
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position))))
(defun open-by-controller (should-collapse-p)
(let* ((region (yafolding-get-element-region))
(beg (car region))
@zarkone
zarkone / signals_handler.clj
Created February 14, 2018 05:41
Intercept POSIX signals (like, from kill -SIGHUP) in Clojure
(ns signals-handler
(:import [sun.misc Signal SignalHandler]))
(defn handle-signals
"Sets up POSIX signal handlers."
[]
(Signal/handle
(Signal. "HUP")
(proxy [SignalHandler] []
(handle [sig]