Skip to content

Instantly share code, notes, and snippets.

View ryantuck's full-sized avatar
🤙
chillin'

Ryan Tuck ryantuck

🤙
chillin'
View GitHub Profile
@ryantuck
ryantuck / excel_csv_export.md
Last active March 17, 2017 19:10
How to overcome Excel being shitty with csv outputs

excel / csv hell

Excel has 2 options for outputting csv files:

  • 'CSV UTF-8' yields UTF-8 Unicode English text, with very long lines, with CR line terminators
  • 'Comma Separated Values' yields Non-ISO extended-ASCII English text, with very long lines, with CRLF line terminators

The first option gives you UTF8 encoding but ends lines with this weird ^M character, which is a DOS thing. The second gives you nice unix line breaks but has ASCII encoding which is no good.

So what you need to do is export as 'CSV UTF-8' and then do the following (to make that ^M you need to hit ctrl-V ctrl-M):

-- find rows where a certain key exists
select
*
from
my_table
where
json_field::jsonb ? 'key_i_want'
;
-- get certain key from json field
-- view interesting information for all queries for a user
select
pid,
client_addr,
application_name,
(current_timestamp - query_start) as duration,
state,
query
from
pg_stat_activity
# define letters in puzzle
letters = [
'g', 'w', 'p', 'e', 'o', 'f',
'v', 'q', 'r', 'x', 's', 'z',
'm', 'c', 'i', 'k', 'u', 'd',
]
# unique words in puzzle 1
words_1 = [
'bus',
@ryantuck
ryantuck / new_machine.md
Last active August 16, 2021 19:49
instructions on setting up a new osx machine

start up postgres after your computer shits the bed and you don't know why it won't start.

cat /usr/local/var/postgres/postmaster.pid
kill 455      # top line of postmaster.pid output
postgres -D /usr/local/var/postgres    # will output some error but stuff works now (shrug)
psql -U ryan test
@ryantuck
ryantuck / ipad_stacking.py
Created October 19, 2016 15:17
stackin' ipads
def num_ipads(rows):
return sum(i+1 for i in range(rows))
def num_rows(ipads):
running_total = 0
i = 0
@ryantuck
ryantuck / dna_strands.py
Created October 11, 2016 22:16
messing around with generating strings given frequencies of substrings in python
import random
# define letters
letters = ['A', 'C', 'T', 'G']
# get a sorted list of your triplets and frequencies
# (assuming you have a way of getting these already)
# (these are for illustration)
trips = ['AAG', 'CCC', 'TTT']
freqs = [0.25, 0.70, 0.05]

Regular Tasks

Regular Tasks include how normal, non-emergency, operational duties are handled—that is, how work is received, queued, distributed, processed, and verified, plus how periodic tasks are scheduled and performed. All services have some kind of normal, scheduled or unscheduled work that needs to be done. Often web operations teams do not perform direct customer support but there are interteam requests, requests from stakeholders, and escalations from direct customer support teams. These topics are covered in Chapters 12 and 14.

Sample Assessment Questions

@ryantuck
ryantuck / keyboard_maestro.png
Last active September 13, 2016 14:34
Salvage your caps lock key if you fucked up and upgraded to macOS Sierra.
keyboard_maestro.png