Skip to content

Instantly share code, notes, and snippets.

View fadeev's full-sized avatar

Denis Fadeev fadeev

View GitHub Profile
@fadeev
fadeev / gist:1127889
Created August 5, 2011 16:15
Get a single character from the console
# From the Highline gem, https://github.com/JEG2/highline
def get_character( input = STDIN )
raw_no_echo_mode
begin
input.getbyte
ensure
restore_mode
end
@fadeev
fadeev / cyr_functions.rb
Created September 11, 2011 13:09
Downcase, upcase and “delatin” functions for strings in cyrillic
# encoding: utf-8
class String
def cyr_downcase
self
.unpack("U*")
.map { |c| if (1040..1071) === c then (c + 32) elsif (1025 == c) then 1105 else c end }
.pack("U*")
end
@fadeev
fadeev / cons-if.rb
Created September 13, 2011 16:50
Cons, car and cdr in Ruby
def cons a, b
lambda { |pick|
return a if pick == 1
return b if pick == 2
}
end
def car cons
cons.call 1
end
@fadeev
fadeev / cons-if.py
Created September 14, 2011 05:21
Cons, car and cdr in Python
def cons(x,y):
return lambda pick: x if pick == 1 else y
def car(cons):
return cons(1)
def cdr(cons):
return cons(2)
@fadeev
fadeev / gist:1486429
Created December 16, 2011 15:19
Debian on a Laptop
aptitude install iwlwifi wpasupplicant
In [ /etc/network/interfaces ] add the following:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid [ wireless-network ]
wpa-psk [ password ]
Configure keyboard layout: dpkg-reconfigure keyboard-configuration
@fadeev
fadeev / gist:2486368
Created April 25, 2012 04:31
ANSI Common Lisp (exercises)
;; Exercise 3.2, p. 56
(defun union-in-order (&rest lists)
"Returns a union of lsts, preserving the order"
(remove-duplicates (reduce #'append lists)
:from-end t
:test #'equal))
;; Exercise 3.3, p. 56
(defun sort-by-frequency (list)
"Returns sorted by frequency alist of occurrences,
(setq backup-directory-alist '(("." . "~/.emacs.d/backups/"))
backup-by-copying 1
auto-save-default 0
inhibit-splash-screen 1
ring-bell-function 'ignore
coding-system-for-write 'utf-8
coding-system-for-read 'utf-8
inferior-lisp-program "/usr/local/bin/sbcl --noinform")
(set-language-environment "Russian")
@fadeev
fadeev / settings.json
Created March 9, 2019 05:43
VS Code Settings
{
"workbench.sideBar.location": "right",
"editor.minimap.enabled": false,
"workbench.statusBar.feedback.visible": false,
"editor.tabSize": 2,
"editor.renderIndentGuides": false,
"editor.detectIndentation": false,
"html.format.indentInnerHtml": true,
"terminal.integrated.macOptionIsMeta": true,
"explorer.confirmDelete": false,

Keybase proof

I hereby claim:

  • I am fadeev on github.
  • I am fadeev (https://keybase.io/fadeev) on keybase.
  • I have a public key ASCLEPVE0l2nhHEREkYXZWAuB3hDJbryWAaKclgGiTevTwo

To claim this, I am signing this object: