This is the quickest way I've found to kill all tmux sessions
# detach from each session
<prefix>d
# kill tmux and all sessions
tmux kill-server
This is the quickest way I've found to kill all tmux sessions
# detach from each session
<prefix>d
# kill tmux and all sessions
tmux kill-server
barrette batterer | |
barye beray yerba | |
basally salably | |
basaltic cabalist | |
base besa sabe | |
basion bonsai sabino | |
basketwork workbasket | |
bastille listable | |
bat tab | |
batcher brachet |
WEB_SAFE_NUMBERS = [ | |
0, # 00 | |
51, # 33 | |
102, # 66 | |
153, # 99 | |
204, # cc | |
255 # ff | |
] | |
def closest_web_safe_color(string) |
WEB_SAFE_NUMBERS = [ | |
0, # 00 | |
51, # 33 | |
102, # 66 | |
153, # 99 | |
204, # cc | |
255 # ff | |
] | |
def closest_web_safe_color(string) |
# https://leetcode.com/problems/count-primes/description/ | |
# return the number of prime numbers less than a positive number n | |
def count_primes(n) | |
primes = [] | |
(2..n-1).each do |i| | |
primes[i] = true | |
end | |
(2..Math.sqrt(n)).each do |i| |
class Solution | |
def initialize | |
@known_strings = {} | |
end | |
def word_break(string, word_dict) | |
if @known_strings[string] | |
return @known_strings[string] | |
end |
def replace_words(dict, sentence) | |
regex = /\A(#{dict.join('|')})/ | |
sentence.split.inject([]) do |new_words, word| | |
if match_data = word.match(regex) | |
new_words << match_data.captures[0] | |
else | |
new_words << word | |
end | |
end.join(' ') |
defmodule Search do | |
def chop(_val, []), do: -1 | |
def chop(val, [head|tail]) when tail == [] do | |
if val == head, do: 0, else: -1 | |
end | |
def chop(val, list) do | |
chop(val, 0, length(list) - 1, list) | |
end |
class Dependencies | |
def initialize | |
@dependencies = Hash.new {|h,k| h[k] = []} | |
end | |
def add_direct item, new_dependencies | |
@dependencies[item] += new_dependencies | |
end | |
def dependencies_for item |
def validate_messages(message) | |
message.split(' ').each do |msg| | |
if valid? msg | |
puts msg + " VALID" | |
else | |
puts msg + " INVALID" | |
end | |
end | |
end |