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
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
# 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
# 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
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
-- 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
#!/usr/bin/env ruby | |
# This script makes a series of A3 posters for cutting from a bunch of images. | |
require "rational" | |
R_4_3 = Rational(4, 3) | |
R_3_4 = Rational(3, 4) | |
system "rm -rf out" |
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
#include <functional> | |
#include <set> | |
#include <string> | |
#include <vector> | |
#include <iostream> | |
#include <unistd.h> | |
#include <sys/wait.h> | |
void | |
run_all( const std::vector< std::string >& source_files, |
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
function printHexDump(s) { | |
const W = 16 | |
let bytes = Buffer.from(s) | |
for (let i = 0; i < bytes.length;) { | |
let hexRow = [] | |
let asciiRow = [] | |
let rowOffset = i |
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 | |
# This script rotates AWS credentials. | |
# It's very quick and dirty and unsafe. | |
# It's possible that something is gonna fail along the way and you're | |
# gonna end up with broken or no credentials at all. You can always fix | |
# them from the AWS dashboard later. | |
# The script expects ~/bin/aws-credentials to be present and executable. | |
# This file is overwritten with the new credentials at the end. |