Skip to content

Instantly share code, notes, and snippets.

# list files, grab the file name, and print only up to the first underscore
# example: W555666777_19761028_30.xml
ll | awk {'print $9'} | awk -F_ {'print $1'} | uniq | awk -F. {'print $1'} | uniq | grep '^W'

Secure device

passwd    # change "chip" account's password
sudo passwd -l root    # lock the root account from direct login
sudo sed -i.old /etc/ssh/sshd_config -e'/PermitRootLogin/s/yes/no/'    # configure sshd to not allow root
sudo service ssh restart

Safe shutdown

class GildedRose
attr_accessor :items
def initialize(items)
@items = items
end
def update_quality
end
end
function Yatzy(dice) {
const callDirectory = {
ones: 1,
twos: 2,
threes: 3,
fours: 4,
fives: 5,
sixes: 6
}
const sum = function(dice, num) {
module DecimalRebase
# Breaks the decimal down into increments of the difference of the increment and the base number until the result is zero
# The resulting increments are accumulated and when the rebased value reaches zero, their modulos are mapped, reversed, and converted
#
# Example:
# value: 75 converted to base: 8
# rebase(75, 8)
# 75 / 8 = 9 => rebase(9, 8, [75])
# 9 / 8 = 1 => rebase(1, 8, [75,9])
# 1 / 8 = 0 => rebase(0, 8, [75,9,1]
sudo killall VDCAssistant
=FILTER(QUERY('DATA IMPORT'!$A:$C, "select A,C"), EQ('DATA IMPORT'!$B:$B, "Value-To-Filter-Against"))
SmallThings::Application.routes.draw do
namespace :core do
resources :things, param: :name, only: [:create, :show] do
member do
resource :component, only: :create, module: :things, as: :things_component
end
end
end
end
#!/bin/bash
remote=origin
author=Drew
date_pattern_to_exclude=2017-11
for branch in `git branch -r | grep -v HEAD `
do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch
done | grep $author | grep $remote | grep -v $date_pattern_to_exclude | awk {'print $10'} | sed -e 's/origin\///' | xargs -I {} git push origin :{}