Skip to content

Instantly share code, notes, and snippets.

🍇
tranquiloquint

Alex Agranov alexagranov

🍇
tranquiloquint
Block or report user

Report or block alexagranov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexagranov
alexagranov / Preferences.el
Created Jun 8, 2019
Aquamacs preferences
View Preferences.el
;; ~/Library/Preferences/Aquamacs Emacs/Preferences.el
;; This is the Aquamacs Preferences file.
;; Add Emacs-Lisp code here that should be executed whenever
;; you start Aquamacs Emacs. If errors occur, Aquamacs will stop
;; evaluating this file and print errors in the *Messags* buffer.
;; Use this file in place of ~/.emacs (which is loaded as well.)
(custom-set-variables
;; custom-set-variables was added by Custom.
@alexagranov
alexagranov / .dir-locals.el
Created Apr 3, 2019
Emacs local indent config for web-mode
View .dir-locals.el
((web-mode . ((web-mode-code-indent-offset . 2)
(web-mode-css-indent-offset . 2)
(web-mode-markup-indent-offset . 2))))
@alexagranov
alexagranov / bespoke_flatten.rb
Last active Mar 1, 2018
Flatten arbitrarily nested arrays without using #flatten :-)
View bespoke_flatten.rb
# frozen_string_literal: true
require 'test/unit'
class BespokeFlattenTest < Test::Unit::TestCase
def bespoke_flatten(arr, accum = [])
return arr unless arr.is_a?(Array)
until arr.empty?
elem = arr.shift
elem.is_a?(Array) ? bespoke_flatten(elem, accum) : (accum << elem)
@alexagranov
alexagranov / count_tabs.pl
Created Nov 2, 2016
Count number of tabs per line
View count_tabs.pl
#!/usr/bin/perl
use strict;
use warnings;
use v5.18;
my $MAX_TABS = 22;
while (<STDIN>) {
chomp $_;
my $c = ($_ =~ tr/\t//);
@alexagranov
alexagranov / git_lfs.rb
Created Apr 19, 2016
Custom Overcommit hook to replace the hook installed by git-lfs (which Overcommit removes)
View git_lfs.rb
# .git_hooks/pre_push/git_lfs.rb
# Be sure to enable this hook in .overcommit.yml like this:
#
# PrePush:
# GitLfs:
# enabled: true
module Overcommit::Hook::PrePush
class GitLfs < Base
View web.el
;;; package -- Summary:
;;; Commentary:
;;; Hooks for web mode
;;; Code:
(require 'web-mode)
View .bash_aliases
#!/bin/bash
alias ll='ls -al'
alias gimmeawindow="xterm -b 4 -sb -sl 5000 -geometry 110x60 -vb -fg yellow -bg black -fa \'Consolas\' -fs 16 &"
alias strace='dtruss'
alias start_postgres='pg_ctl -D /usr/local/var/postgres -l /var/log/postgres.log start'
alias stop_postgres='pg_ctl -D /usr/local/var/postgres stop -m fast'
alias ssh_to_master_db='ssh -o TCPKeepAlive=yes -o ServerAliveInterval=300 -L 5452:localhost:5432 root@master-db -p 22'
View gist:d7ac066eda99f9e485ea
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
View gist:1e84c17e1210e4e062af
sudo cpan Regexp::Debugger
vi /tmp/t.pl
`'abc' =~ /abx|c/`
perl -MRegexp::Debugger /tmp/t.pl
or
rxrx /tmp/t.pl
@alexagranov
alexagranov / .emacs
Last active Jun 16, 2019
my .emacs config
View .emacs
(require 'tls)
(push "/usr/local/etc/libressl/cert.pem" gnutls-trustfiles)
;; ____________________________________________________________________________
;; Aquamacs custom-file warning:
;; Warning: After loading this .emacs file, Aquamacs will also load
;; customizations from `custom-file' (customizations.el). Any settings there
;; will override those made here.
;; Consider moving your startup settings to the Preferences.el file, which
;; is loaded after `custom-file':
You can’t perform that action at this time.