Skip to content

Instantly share code, notes, and snippets.

View mohataher's full-sized avatar

Mohamed Taher Alrefaie mohataher

View GitHub Profile
@mohataher
mohataher / java-8-ami.md
Last active August 2, 2016 16:12 — forked from rtfpessoa/java-8-ami.md
[Guide] Install Sun Java 8 on Amazon EC2 Ami

First verify the version of Java being used is not Sun Java 8 SDK

java -version

Get the Sun Java 8 SDK from Oracle

wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/8u73-b02/jdk-8u73-linux-x64.rpm"

Install Sun Java 8

sudo rpm -i jdk-8u73-linux-x64.rpm

Check if the default java version is set to Sun Java 8 SDK

@mohataher
mohataher / close_all_management_instances_in_titan_db.md
Last active October 10, 2023 10:14
Gremlin query to close all management instances in Titan database.
mgmt = graph.openManagement()
it=mgmt.getOpenInstances().iterator(); while (it.hasNext()){ nxt=it.next(); if(!nxt.contains("current"))  mgmt.forceCloseInstance(nxt)}
mgmt.commit()
@mohataher
mohataher / setup-oraclejava8-git-maven.sh
Created April 5, 2016 15:49
Set up a new Ubuntu instance on EC2
#!/bin/sh
# install oracle 8
# source: http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
# install maven and git
sudo apt-get install git maven
@mohataher
mohataher / Install-Lboro-Printer-On-Ubuntu.md
Created June 1, 2016 17:41
How to install printers on Ubuntu at Loughborough University

How to install printers on Ubuntu at Loughborough University

Install SMB Client

The university use SMB client to communicate; it doesn't come prepacked so you need to install it.

sudo apt-get install smbclient
@mohataher
mohataher / hr.csv
Created January 24, 2018 16:50
load-polar-hr-data-to-python-pandas-dataframe
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 26 columns, instead of 12. in line 2.
Name,Sport,Date,Start time,Duration,Total distance (km),Average heart rate (bpm),Average speed (km/h),Max speed (km/h),Average pace (min/km),Max pace (min/km),Calories,Fat percentage of calories(%),Average cadence (rpm),Average stride length (cm),Running index,Training load,Ascent (m),Descent (m),Notes,Height (cm),Weight (kg),HR max,HR sit,VO2max,
MTA,OTHER_INDOOR,23-06-2017,13:43:56,00:08:40,0.00,77,,,,,17,71,,,,,,,,170.0,64.0,,,,
Sample rate,Time,HR (bpm),Speed (km/h),Pace (min/km),Cadence,Altitude (m),Stride length (m),Distances (m),Temperatures (C),Power (W),
1,00:00:00,75,,,,,,,,,
,00:00:01,75,,,,,,,,,
,00:00:02,75,,,,,,,,,
,00:00:03,76,,,,,,,,,
,00:00:04,77,,,,,,,,,
,00:00:05,78,,,,,,,,,
,00:00:06,86,,,,,,,,,
import pandas as pd
import datetime
import time
row=None
with open("hr.csv") as fp:
for i, line in enumerate(fp):
if i == 1:
print(line)
row=line
{
'I',
'you',
'my',
'mine',
'myself'
'we',
'us',
'our',
'ours',