Skip to content

Instantly share code, notes, and snippets.

python3.6 -m venv /tmp/venv_smekh
. /tmp/venv_smekh/bin/activate
pip install azure mrjob warcio
#!/bin/bash
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install -y python3.6 python3.6-dev python3.6-venv
python3.6 -m venv venv_smekh
. venv_smekh/bin/activate
pip install azure mrjob warcio
def tokenize_story_line(story_line):
tokens = re.findall(r'(\w+)', story_line)
return tokens
def load_stories(file):
data = []
with file.open() as f:
story = []
@jgc128
jgc128 / main.py
Created August 13, 2017 15:43
PyTroch DataParallel Example
import numpy as np
import torch
import torch.nn
import torch.cuda
from torch.autograd import Variable
class Net(torch.nn.Module):
def __init__(self):
-63278844
-63278845
-63278846
-63278847
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jgc128
jgc128 / test_keras.ipynb
Created October 26, 2015 02:49
Test Keras library
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jgc128
jgc128 / common.py
Last active October 17, 2015 01:42
Code for homework 1 (2015 Fall NLP Class)
import os
base_dir = '/data1/aromanov/study/2015_fall/nlp/homeworks/hw1/'
brit3_filename = os.path.join(base_dir, 'brit3-excerpt.txt')
brit3_marked_filename = os.path.join(base_dir, 'brit3-excerpt-marked.txt')
problem4_text_filename = os.path.join(base_dir, 'problem4.txt')
def load_documents_from_dir(directory):
files = [os.path.join(directory, f) for f in os.listdir(directory)]
@jgc128
jgc128 / probem_4.ipnb
Created September 28, 2015 17:30
Problem 4 for NLP class
{
"cells": [
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@jgc128
jgc128 / StartGame.cs
Created August 3, 2015 16:02
StartGame.
var gamePackageName = Resources.GetString(Resource.String.game_package_name);
var gameIntent = PackageManager.GetLaunchIntentForPackage(gamePackageName);
if (gameIntent == null)
{
try {
StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse("market://details?id=" + gamePackageName)));
} catch (ActivityNotFoundException) {
StartActivity(new Intent(Intent.ActionView, Android.Net.Uri.Parse("http://play.google.com/store/apps/details?id=" + gamePackageName)));
}
}