Skip to content

Instantly share code, notes, and snippets.

View AlexJoz's full-sized avatar

Alex Joz AlexJoz

View GitHub Profile
@AlexJoz
AlexJoz / gist:82512ccc641d424a8c21cca9c100094b
Created March 31, 2019 00:37
index.html example sample
<!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:924de4f9aedc8ac03e3b9c65eb2c2dea
Created June 22, 2017 08:00
SSH usecases and examples
https://habrahabr.ru/post/331348/
@AlexJoz
AlexJoz / gist:dbea2d2385f79505efa1fa36f3372815
Created May 11, 2017 12:12
Python locale error: unsupported locale setting
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales
@AlexJoz
AlexJoz / gist:c3a39ad13cba2f2492240eed5b0fbc2c
Created April 20, 2017 13:38
Python Twisted call func every minute =)
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 April 14, 2017 07:48
JSON ENCODER for ObjectID from MongoDB
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 March 23, 2017 09:42
compile tensorflow with sse3, sse4.1\2, avx, cuda support
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 January 10, 2017 13:44
Some nice ubuntu commands ^^
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 November 18, 2016 14:22
Download file from http link with python2
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 November 17, 2016 20:07
Get day of year from rfc2822 email time in Python
#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 August 5, 2016 16:22
Syncronize files with running ec2 instance (download data from aws)
sudo rsync -azv -e "ssh -i /home/ubuntu/key-to-ec2.pem" [email protected]:/home/ubuntu/source/ /home/ubuntu/target