This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Copyright (C) 2017 Dmitry Yakimenko ([email protected]). | |
-- Licensed under the terms of the MIT license. See LICENCE for details. | |
-- Duplicate line Far Manager editor macro | |
Macro { | |
description = "Duplicate line"; | |
area = "Editor"; | |
key = "CtrlD"; | |
action=function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template < typename Container, typename Function > | |
auto map_to_set( const Container& c, Function f ) -> std::set< decltype( f( *c.begin( ) ) ) > | |
{ | |
std::set< decltype( f( *c.begin( ) ) ) > result; | |
for ( auto&& i : c ) | |
result.insert( f( i ) ); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aliases | |
alias ll='ls -lha' | |
# Zplug is managed by Homebrew | |
export ZPLUG_HOME=/usr/local/opt/zplug | |
source $ZPLUG_HOME/init.zsh | |
# Prezto | |
zplug "modules/environment", from:prezto | |
zplug "modules/completion", from:prezto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the host to run the container | |
docker run --privileged -i -t -v ~/host-folder-to-mount:/root/folder-ro:ro ubuntu | |
# Inside the container | |
# Need to create the upper and work dirs inside a tmpfs. | |
# Otherwise OverlayFS complains about AUFS folders. | |
mkdir -p /tmp/overlay && \ | |
mount -t tmpfs tmpfs /tmp/overlay && \ | |
mkdir -p /tmp/overlay/{upper,work} && \ | |
mkdir -p /root/folder && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File.binread("filename.bin").split(/(?=\x15\x01)/).each_with_index do |data, i| | |
File.open("filename-%02d.bin" % i, "wb") do |io| | |
io.write data | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime | |
import sublime_plugin | |
# TODO: Rename this | |
# TODO: Configure the wrap column | |
# TODO: Add join and reformat | |
class ExampleCommand(sublime_plugin.TextCommand): | |
WRAP_COLUMN = 75 | |
def run(self, edit): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Clone repos locally into original/ | |
( | |
mkdir original | |
cd original | |
git clone [email protected]:detunized/lastpass-sharp.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @param {String} s | |
# @return {Integer} | |
def num_decodings(s) | |
return 0 if s.empty? | |
n1 = 1 | |
n2 = 0 | |
i = 0 | |
while i < s.size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
begin | |
require "parallel" | |
PARALLEL = true | |
rescue LoadError | |
PARALLEL = false | |
end | |
def each collection, &block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# DSL implementation | |
# | |
$stack = [""] | |
def emit x | |
$stack.last << x |