As configured in my dotfiles.
start new:
tmux
start new with session name:
| // 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
| // You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
| (() => { | |
| const SHOW_SIDES = false; // color sides of DOM nodes? | |
| const COLOR_SURFACE = true; // color tops of DOM nodes? | |
| const COLOR_RANDOM = false; // randomise color? | |
| const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
| const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
| const THICKNESS = 20; // thickness of layers | |
| const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
| ["Africa/Algiers", "West Central Africa"], | |
| ["Africa/Cairo", "Cairo"], | |
| ["Africa/Casablanca", "Casablanca"], | |
| ["Africa/Harare", "Harare"], | |
| ["Africa/Johannesburg", "Pretoria"], | |
| ["Africa/Monrovia", "Monrovia"], | |
| ["Africa/Nairobi", "Nairobi"], | |
| ["America/Argentina/Buenos_Aires", "Buenos Aires"], | |
| ["America/Bogota", "Bogota"], | |
| ["America/Caracas", "Caracas"], |
| require 'excon' | |
| require 'securerandom' | |
| def multipart_form_data(buildpack_file_path) | |
| body = '' | |
| boundary = SecureRandom.hex(4) | |
| data = File.open(buildpack_file_path) | |
| data.binmode if data.respond_to?(:binmode) | |
| data.pos = 0 if data.respond_to?(:pos=) |
| require 'active_record/connection_adapters/abstract/transaction' | |
| module ActiveRecord | |
| module ConnectionAdapters | |
| class SavepointTransaction < OpenTransaction | |
| def perform_commit_with_transactional_fixtures | |
| commit_records if number == 1 | |
| perform_commit_without_transactional_fixtures | |
| end | |
| alias_method_chain :perform_commit, :transactional_fixtures |
| #!/usr/bin/env ruby | |
| require 'webrick' | |
| srv = WEBrick::HTTPServer.new( | |
| :BindAddress => '127.0.0.1', # '0.0.0.0' allow remote access | |
| :Port => (port = ARGV[0].to_i) === 0 ? 3000 : port, | |
| :DocumentRoot => './', | |
| :DoNotReverseLookup => true | |
| ) | |
| trap(:INT){srv.shutdown} | |
| srv.start |
| #!/usr/bin/env python | |
| #-*- coding:utf-8 -*- | |
| import imaplib | |
| import getpass | |
| import argparse | |
| argparser = argparse.ArgumentParser(description="Dump a IMAP folder into .eml files") | |
| argparser.add_argument('-s', dest='host', help="IMAP host, like imap.gmail.com", required=True) | |
| argparser.add_argument('-u', dest='username', help="IMAP username", required=True) |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| # Russian. Updated 2012-07-18 | |
| ru: | |
| admin: | |
| home: | |
| name: "Главная" | |
| pagination: | |
| previous: "« Предыдущая" | |
| next: "Следующая »" | |
| truncate: "…" |
| #! usr/bin/env ruby | |
| require 'chunky_png' | |
| class ChunkyPNG::Image | |
| # s: Integer (pixel size) | |
| def pixelize s = 10 | |
| temp = Array.new((height*1.0/s).ceil) {Array.new((width*1.0/s).ceil) {Array.new(3) {0}}} | |
| height.times {|j| width.times {|i| ChunkyPNG::Color.to_truecolor_bytes(get_pixel(i,j)).each.with_index {|e,k| temp[j/s][i/s][k] += e}}} | |
| png = ChunkyPNG::Image.new width, height | |
| sq = s**2 |