Skip to content

Instantly share code, notes, and snippets.

View olest's full-sized avatar

olest

View GitHub Profile
@olest
olest / google_speech_stt_api.py
Created May 11, 2019 10:13
Example of using google speech (stt) using python
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
def main():
credentials_json = "/path/to/json/file"
from google.oauth2 import service_account
cred = service_account.Credentials.from_service_account_file(credentials_json)
@olest
olest / future_dates.py
Created April 5, 2019 16:34
Print future dates in python
import datetime
now = datetime.datetime.now()
from datetime import timedelta
diff = datetime.timedelta(days=42)
future = now + diff
future.strftime("%m/%d/%Y")
@olest
olest / inspect_trial.py
Created October 11, 2018 15:53
Using python package inspect
#/usr/bin/python
from __future__ import print_function
from __future__ import absolute_import
import inspect
import sys
def foo1():
pass
@olest
olest / plot_freq_factor.R
Created November 28, 2017 16:04
R : plot frequency of factor variable
df <- data.frame(Foo=c("A","B","A","B","B","C"))
pt <- as.data.frame(table(df))
ggplot(pt,aes(x=df,y=Freq)) + geom_bar(stat="identity")
pt$dfOrdered <- reorder(pt$df,pt$Freq)
ggplot(pt,aes(x=dfOrdered,y=Freq)) + geom_bar(stat="identity")
ggplot(pt,aes(y=Freq,x=dfOrdered,fill=dfOrdered)) + geom_bar(stat="identity") + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + theme(legend.position="none")
@olest
olest / hyperpand_install
Last active July 24, 2017 12:40
Install hyperband
virtualenv hb_venv
source ~/hb_venv/bin/activate
pip install hyperopt
pip install scikit-learn
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
@olest
olest / gputest.lua
Created June 9, 2016 16:11 — forked from jaderberg/gputest.lua
GPU Torch Benchmark
-- Max Jaderberg 4/9/13
-- GPU Effectiveness test
require 'torch'
require 'sys'
require 'nn'
require 'xlua'
cmd = torch.CmdLine()
cmd:text()
@olest
olest / git.hacks.txt
Created January 12, 2016 15:30
Import git commands
*** Discard git merge:
git reset --hard HEAD
*** Push a new local branch to a remote Git repository and track it too
$ git checkout -b feature_branch_name
... edit files, add and commit ...
$ git push -u origin feature_branch_name
*** To clean-up dead local branches:
git remote prune origin
@olest
olest / machine-learning-basics.py
Created December 28, 2015 22:49 — forked from pupadupa/machine-learning-basics.py
Some machine learning algorithm for Titanic dataset. SVM, Random Forest, XGBoost. Link to kaggle https://www.kaggle.com/c/titanic
# Be sure that you have installed libraries (if not - google it):
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import xgboost as xgb
from sklearn.preprocessing import LabelEncoder
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_squared_error
from sklearn import cross_validation