(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
require 'sinatra/base' | |
require 'memcached' | |
module Sinatra | |
module Memcacher | |
module Helpers | |
def cache(key, &block) | |
return block.call unless options.memcacher_enabled | |
begin |
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
module NewRelic | |
class SidekiqException | |
def call(worker, msg, queue) | |
begin | |
yield | |
rescue => exception | |
NewRelic::Agent.notice_error(exception, :custom_params => msg) | |
raise exception | |
end | |
end |
# There was a day where I have too many color schemes in iTerm2 and I want to remove them all. | |
# iTerm2 doesn't have "bulk remove" and it was literally painful to delete them one-by-one. | |
# iTerm2 save it's preference in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format | |
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files. | |
$ cd /tmp/ | |
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist . | |
$ plutil -convert xml1 com.googlecode.iterm2.plist | |
$ vi com.googlecode.iterm2.plist |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This is a sequel to "Postfix: relay to authenticated SMTP".
I would like to send mail from two different Gmail accounts using Postfix. Here is the relevant section in the Postfix documentation: Configuring Sender-Dependent SASL authentication.
As a concrete example, here's how to set up two Gmail accounts (only relevant sections of the config files are listed below):
/etc/postfix/main.cf:
# sender-dependent sasl authentication
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
" Insert into your .vimrc after quick-scope is loaded. | |
" Obviously depends on <https://github.com/unblevable/quick-scope> being installed. | |
" Thanks to @VanLaser for cleaning the code up and expanding capabilities to include e.g. `df` | |
let g:qs_enable = 0 | |
let g:qs_enable_char_list = [ 'f', 'F', 't', 'T' ] | |
function! Quick_scope_selective(movement) | |
let needs_disabling = 0 |
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
# Elixir has lazily evaluated enumerable objects that allow you | |
# to work with enumerable objects like lists either only as needed | |
# or infinitely. | |
# Start up iex to play around | |
$ iex | |
# Typical enumeration is done eagerly where the result is computed ASAP | |
iex> Enum.map(1..10, fn i -> i * 2 end) | |
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20] |