This file contains 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
begin; | |
lock my_table in exclusive mode; | |
delete from my_table where key='key'; | |
insert into my_table (key, value) values ('key', 'value'); | |
commit; |
This file contains 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
[alias] | |
history = log --pretty=format:'%C(red) %h %C(yellow) %ad %C(green) %an %C(white) %s' --date=relative | |
newbranch = checkout -b |
This file contains 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
python helloworld.py > helloworld.out & echo $! > helloworld.pid | |
cat helloworld.pid | xargs kill -9 |
This file contains 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 -H pip install drawille | |
wget https://raw.githubusercontent.com/asciimoo/drawille/master/examples/xkcd.py | |
mkdir -p ~/.terminalscripts/ | |
mv xkcd.py ~/.terminalscripts/xkcd.py | |
alias xkcd="python ~/.terminalscripts/xkcd.py" |
This file contains 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
library(survey) | |
load("~/CCES/CCES2016_Common_FirstRelease.RData") | |
survObj <- svydesign(ids = ~1, data = x, weights = x$commonweight_post) | |
prop.table(svytable(~CC16_410a, design = survObj)) |
This file contains 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
from nltk.tokenize import sent_tokenize | |
text = """All of the MSM is fake news at this point. Their blind hatred of Trump has caused them to throw away what credibility they once had. | |
#DeathToTheMSM""" | |
sent_tokenize_list = sent_tokenize(text) | |
for sentence in sent_tokenize_list: | |
print sentence |
This file contains 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
# clip videos and delete original | |
ffmpeg -hide_banner -y -i clipped.avi -vf "trim=start=0:end=2,setpts=PTS-STARTPTS" -an tiny.avi && rm -rf clipped.avi | |
# Extract Frames | |
ffmpeg -i vid4.avi frames/vid4/%04d.jpg -hide_banner | |
# Download videos from Youtube | |
youtube-dl --get-filename -o '%(id)s_%(fps)s.%(ext)s' w4JM08PDEng -f 'bestvideo[height<=240]' |
This file contains 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
def generator(features, labels, batch_size): | |
# Create empty arrays to contain batch of features and labels# | |
batch_features = np.zeros((batch_size, 64, 64, 3)) | |
batch_labels = np.zeros((batch_size,1)) | |
while True: | |
for i in range(batch_size): | |
# choose random index in features |
This file contains 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
# Create generator | |
train_generator = MSRVTTSequence(train_captions, video_folder=videos_folder, fps_dict=video_fps, tag_dict=tags, batch_size=16) | |
validation_generator = MSRVTTSequence(validation_captions, video_folder=videos_folder, fps_dict=video_fps, tag_dict=tags, batch_size=16) | |
from keras.applications.resnet50 import ResNet50 | |
from keras.layers import TimeDistributed, Bidirectional | |
from keras.layers import Input, LSTM, Dense | |
from keras.models import Model | |
from keras.callbacks import CSVLogger, ModelCheckpoint, ReduceLROnPlateau |
This file contains 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
from keras.models import Model | |
from keras.layers import Input, LSTM, Dense, TimeDistributed | |
inputs = Input(batch_shape=(8,16,1024)) | |
layer = LSTM(256, return_state=True, return_sequences=True) | |
outputs = layer(inputs) | |
# TODO Add Teacher Forcing | |
output, state = outputs[0], outputs[1:] | |
output = LSTM(256)(output, initial_state=state) |
OlderNewer