https://dev.to/joseph_lozano/setting-up-a-new-phoenix-1-5-project-with-phoenix-liveview-309n https://github.com/joseph-lozano/Feenix https://dev.to/joseph_lozano/magic-sign-in-links-with-elixir-and-phoenix-1-5-496k
This file contains hidden or 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
module RactorPool | |
# static sized pool with supervision | |
# use multi_use at own risk - be sure to collect results before submitting more messages | |
class WorkerPool | |
attr_reader :behavior, :inputs, :input_queue, :multi_use, :worker_count, :workers_pool | |
def self.call(input, behavior, options = {}) | |
new(input, behavior, options) | |
end |
This file contains hidden or 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
module RactorPool | |
# using the ForkedJoin pattern - https://en.wikipedia.org/wiki/Fork%E2%80%93join_model | |
# this creates a worker pool (of Ractors) as large as the number of input messages | |
# and then collects the results upon completion - at which point the Ractors are | |
# removed from the worker pool and available to be garbage collected | |
# note: the injected behavior must respond to #call(input) | |
# usage: define a behavior that responds to #call(input) | |
# class Fibonacci | |
# def call(n) = [n, fib(n)] | |
# def fib(n) = n < 2 ? 1 : fib(n-2) + fib(n-1) |
This file contains hidden or 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
# returns analysis | |
# Utilization | |
# Bash | |
echo "count day hour techs" > util-by-hr.csv | |
cat laptop-inventory.csv | cut -d';' -f44 | grep 2014 | cut -d'"' -f2 | sed 's/:[0-9][0-9]:[0-9][0-9]$/:00/g' | grep '2014-05' | sed 's/2014-05-//g' | grep '2[0-9]' | sort | uniq -c | awk ' {print $1, $2, $3, 1}' >> util-by-hr.csv | |
echo "count day time techs" > util-by-10min.csv |
This file contains hidden or 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
---------------- | |
# returns analysis | |
# Start in Bash | |
# METHOD 1 | |
curl -k https://inventory.las.ch/serial.csv?scope=computers > laptop-inventory.csv | |
cat laptop-inventory.csv | cut -d';' -f44 | grep 2014 | cut -d'"' -f2 > return-data.csv |
This file contains hidden or 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
use inventory; | |
UPDATE computers SET status='Retired' WHERE id='96'; | |
UPDATE computers SET status='Retired' WHERE id='104'; | |
UPDATE computers SET status='Retired' WHERE id='108'; | |
UPDATE computers SET status='Retired' WHERE id='119'; | |
UPDATE computers SET status='Retired' WHERE id='181'; | |
UPDATE computers SET status='Retired' WHERE id='187'; |
This file contains hidden or 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
USE inventory; | |
#ALTER TABLE computers ADD fleet_id INT(11) AFTER id; | |
#UPDATE computers SET fleet_id=date_made WHERE date_made REGEXP '^-?[0-9]+$'; | |
#SELECT fleet_id FROM computers; | |
ALTER TABLE computers ADD fleetid TEXT AFTER id; | |
UPDATE computers SET fleetid=fleet_id; | |
#ALTER TABLE computers DROP fleet_id; |
This file contains hidden or 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
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle | |
cat <<EOF >> .vimrc | |
set tabstop=2 shiftwidth=2 expandtab | |
:set invlist | |
set listchars=eol:¬,tab:->,trail:~,extends:>,precedes:< | |
:set list |
This file contains hidden or 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
sudo diskutil repairPermissions / | |
sudo softwareupdate -dia | |
sudo diskutil repairPermissions / | |
sudo reboot |
This file contains hidden or 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
brew doctor | |
brew update | |
brew upgrade | |
brew cleanup |
NewerOlder