Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Joz AlexJoz

  • Odessa, Ukraine
View GitHub Profile
View gist:82512ccc641d424a8c21cca9c100094b
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HelloWorld</title>
</head>
<body>
<h1> Hello World! </h1>
<script>
console.log("Hello Console!")
@AlexJoz
AlexJoz / gist:dbea2d2385f79505efa1fa36f3372815
Created May 11, 2017
Python locale error: unsupported locale setting
View gist:dbea2d2385f79505efa1fa36f3372815
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales
@AlexJoz
AlexJoz / gist:c3a39ad13cba2f2492240eed5b0fbc2c
Created Apr 20, 2017
Python Twisted call func every minute =)
View gist:c3a39ad13cba2f2492240eed5b0fbc2c
from twisted.internet import task
from twisted.internet import reactor
timeout = 60.0 # Sixty seconds
def doWork():
#do work here
pass
l = task.LoopingCall(doWork)
@AlexJoz
AlexJoz / gist:0f55e6dc46b9a2f2e49bf29618cda1fb
Created Apr 14, 2017
JSON ENCODER for ObjectID from MongoDB
View gist:0f55e6dc46b9a2f2e49bf29618cda1fb
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, ObjectId):
return str(o)
return json.JSONEncoder.default(self, o)
@AlexJoz
AlexJoz / gist:f6c3599421db57dbb6b1dbf96a4c045c
Created Mar 23, 2017
compile tensorflow with sse3, sse4.1\2, avx, cuda support
View gist:f6c3599421db57dbb6b1dbf96a4c045c
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 --config=cuda -k //tensorflow/tools/pip_package:build_pip_package
@AlexJoz
AlexJoz / gist:a83f245de9bc77e87feccd181ebc848e
Last active Jan 10, 2017
Some nice ubuntu commands ^^
View gist:a83f245de9bc77e87feccd181ebc848e
sudo sgdisk -Z /dev/sdc Wipe guid partition table
sudo apt-get purge `dpkg -l | awk '{print $2}' | grep -E 'gnome|unity'` Wipe unity
sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic for NVidia Optimus cards
@AlexJoz
AlexJoz / download_to_file.py
Created Nov 18, 2016
Download file from http link with python2
View download_to_file.py
import urllib2
#put your link here =)
url = "http://ichart.finance.yahoo.com/table.csv?s=^GSPC&c=2016"
file_name = "table.csv" #can parse fname from url, ofcoz.
u = urllib2.urlopen(url)
gspc = u.read()
with open(file_name, 'wb') as f:
@AlexJoz
AlexJoz / rfc2822_to_day_of_year.py
Created Nov 17, 2016
Get day of year from rfc2822 email time in Python
View rfc2822_to_day_of_year.py
#python2
from email.utils import parsedate_tz
import datetime
z = parsedate_tz('Fri, 1 Jan 2016 17:58:28 +0700')
print z
print datetime.datetime.strptime('{}-{}-{}'.format(z[0],z[1],z[2]), '%Y-%m-%d').timetuple().tm_yday
output:
'''
(2016, 1, 1, 17, 58, 28, 0, 1, -1, 25200)
@AlexJoz
AlexJoz / gist:e6e45e3c84fb7143cb1da0f8c9f46e76
Last active Aug 5, 2016
Syncronize files with running ec2 instance (download data from aws)
View gist:e6e45e3c84fb7143cb1da0f8c9f46e76
sudo rsync -azv -e "ssh -i /home/ubuntu/key-to-ec2.pem" ubuntu@xx.xxx.xxx.xx:/home/ubuntu/source/ /home/ubuntu/target