Skip to content

Instantly share code, notes, and snippets.

View nikos-glikis's full-sized avatar

Nikos Glikis nikos-glikis

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
int main()
{
//Why is this happening ?????????
float x = 0.1;
while (x!=1.1)
{
printf("x = %f\n", x);
@nikos-glikis
nikos-glikis / delete_directory.py
Created August 9, 2015 13:49
Recursive delete directory contents with python
def delete_directory_contents(folder):
for the_file in os.listdir(folder):
file_path = os.path.join(folder, the_file)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path): shutil.rmtree(file_path)
except Exception, e:
print e
@nikos-glikis
nikos-glikis / download_file.py
Last active August 29, 2015 14:27
Download File Python
def download_file(url, local_file):
u = urllib2.urlopen(url)
f = open(local_file , 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (local_file , file_size)
file_size_dl = 0
block_sz = 8192
@nikos-glikis
nikos-glikis / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nikos-glikis
nikos-glikis / kill.sh
Created August 8, 2015 08:29
kill all commands that match text (ps aux)
ps aux | grep "text" | awk '{print $2}' | xargs kill
@nikos-glikis
nikos-glikis / runner.java
Last active August 29, 2015 14:16
Convert mysql DateTime to java Calendar
/**
* Converts a mysql DateTime String to java Calendar
* @param dateString
* @return Calendar
*/
public static Calendar mysqlDateTimeToCalendar(String dateString)
{
try
{
//in my case I hade an . in the end of the date String.