Skip to content

Instantly share code, notes, and snippets.

View lettergram's full-sized avatar
🕶️
Loading...

Austin Walters lettergram

🕶️
Loading...
View GitHub Profile
ffmpeg-i <input video> -r 8 <output gif>
ffmpeg -i <input video> -filter:v "setpts=0.6*PTS" <output video>
@lettergram
lettergram / activerecord_subquery.rb
Last active May 18, 2019 01:06
Create a subquery in Rails using Active Record
query = select(:author, :created_at)
.from(
where("created_at >= ?", Date.today - 6.months)
.order(created_at: :desc)
.limit(100)
).order(author: :asc)
@lettergram
lettergram / postgresql_subquery.sql
Last active May 14, 2019 04:00
Create a subquery in PostgreSQL
/**
* comments
* author
* comment_text
* created_at
**/
SELECT author, created_at FROM
(SELECT * FROM comments WHERE (created_at >= NOW() - interval '6 month')
ORDER BY created_at DESC LIMIT 100) subquery
ORDER BY author ASC;
@lettergram
lettergram / sync_lists_across_files.py
Last active February 27, 2019 05:44
Syncronize content of files across directories, keeping the most up-to-date edits
# Syncronize files across directories, keeping the most up-to-date edits
lists = [
'directory_1/list_of_terms.yaml',
'directory_2/list_of_terms.txt'
]
list_items = {} # Form: [item] = [time(integer), keep(boolean)]
# Generate full list of single_listed items (stores all possible terms)
# Python Implementation of Hello Worms
string = bytearray("Hello, Worms!", 'UTF-8')
for i in range(int(len(string) / 2)): # Cast to int for Range
temp = string[i]
string[i] = string[len(string) - i - 1] # -1 or error
string[len(string) - i - 1] = temp # add -1 or error
print(string.decode('UTF-8'))
# Python Implementation of Hello Worms
string = "Hello, Worms!"
for i in range(int(len(string) / 2)): # Cast to int for range
temp = string[i]
string[i] = string[len(string) - i]
string[len(string) - i] = temp
print(string)
# Python Implementation of Hello Worms
string = bytearray("Hello, Worms!", 'UTF-8')
for i in range(len(string) / 2):
temp = string[i]
string[i] = string[len(string) - i - 1]
string[len(string) - i - 1] = temp
print(string.decode('UTF-8'))
@lettergram
lettergram / austins-protonmail-theme.css
Created January 20, 2019 06:09
ProtonMail Theme CSS
#pm_view {
min-width:70%;
}
#conversation-list-columns{
border-right:none;
background:#F7F6F6;
max-width:30%;
}
#conversation-view{
min-width:68%;
@lettergram
lettergram / austins-proton-theme-conversations.css
Last active January 20, 2019 06:08
CSS For ProtonMail Conversations
/* Conversation List Style */
.conversation{
background:#F8EFFB;
border-color: #FFFFFF;
border-width: thin;
}
.conversation.read{
background:#DDDDDD;
border-color:#DDDDDD;
border-width:none;