Skip to content

Instantly share code, notes, and snippets.

@kirelagin
kirelagin / osx-for-hackers.sh
Created October 7, 2016 13:46 — forked from brandonb927/osx-for-hackers.sh
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned. Also, please don't email me about this script, my poor inbox...
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
airplane balloon:
Уважаемые пассажиры, наш полёт проходит на высоте десять тысяч ёлок.
Уважаемые пассажиры, если вы посмотрите направо — увидите ёлку.
Капитан, ель прямо по курсу!
Сегодня мы будем пролетать над четырьмя странами и елью
В течение полёта вам будут предложены напитки, завтрак и вид на ель.
cm1:
сантиметр
@kirelagin
kirelagin / ncdc
Last active August 29, 2015 14:10
OpenRC init-script for ncdc
#!/sbin/runscript
###
#
# OpenRC init-script for ncdc
#
# Distributed under the terms of the GNU General Public License, v3 or later.
#
# © 2014 Kirill Elagin <kirelagin@gmail.com>
# http://kir.elagin.me/
#
@kirelagin
kirelagin / tmux-magic
Last active November 2, 2023 11:05
tmux magic for OpenRC
###
#
# tmux magic for OpenRC
#
# These functions do some tmux magic to let you run non-daemon programs
# (e.g. ones with ncurses interface) as daemons in tmux sessions.
# You just run `/etc/init.d/<service> start/stop` or add the service
# to a runlevel and later you can do `/etc/init.d/<service> attach` to
# see its console. Type `Ctrl+b d` to detach (in the default tmux configuration).
# We execute tmux with `-L`, so those sessions are not visible in the
@kirelagin
kirelagin / tor-change-exitnode
Last active April 23, 2024 10:23
Shell script to force Tor exit node change
#!/bin/sh
###
#
# Change Tor exit node
#
# Sometimes when using Tor you'd like to change the IP address that
# servers see when you connect (that is, change your Tor exit node).
# This happens automatically from time to time, but this shell script
# lets you force it.
#
@kirelagin
kirelagin / 4-3.pd
Last active January 4, 2016 17:48
hw.latex usage example
% Алгебраические структуры #4
% Кирилл Елагин
36
====
а)
---
@kirelagin
kirelagin / hw.latex
Last active February 26, 2023 18:48
Homework template for pandoc
%%%
%
% Homework template for pandoc
%
% You'll need XeLaTeX.
% You'll need PT fonts (or change them).
%
% Usage:
% pandoc --latex-engine=xelatex --listings --template=<path to this file> <input.pd> -o <output.pdf>
%
@kirelagin
kirelagin / ReadGraph.fs
Last active December 14, 2015 23:19
Reading graphs (and any other inputs) with enhanced State monad using F#'s Computation Expressions' awesomeness.
//// State monad (on F# steroids)
type State<'s, 'a> = State of ('s -> 'a * 's)
let runState (State f) = f
type StateBuilder() =
member __.Return (x : 'a) : State<'s, 'a> = State <| fun st -> (x, st)
member __.Bind (p : State<'s, 'a>, (f : 'a -> State<'s, 'b>)) : State<'s, 'b> =
State <| fun st -> let (v, ns) = runState p st in runState (f v) ns
@kirelagin
kirelagin / testing.rkt
Created February 19, 2013 18:30
Testing framework for Racket
;;;
;
; Testing framework for Racket
;
; Being very minimalistic this framework was designed to be as easy to learn as possible
; and to be just enough for those taking the “Programming Languages” course at Coursera
; [https://class.coursera.org/proglang-2012-001/].
;
; https://gist.github.com/4988539
;
@kirelagin
kirelagin / useradd-ldap.py
Last active October 22, 2021 21:41
Adding users to ldap database
#!/usr/bin/env python
import sys
import os.path
import ldap
import ldap.dn
import ldap.filter
import ldap.modlist
SERVER_URI = 'ldap://127.0.0.1'