Skip to content

Instantly share code, notes, and snippets.

View d30jeff's full-sized avatar
💭
Eating caviar and hacking famine

Deojeff d30jeff

💭
Eating caviar and hacking famine
View GitHub Profile
import requests, json
from time import strftime
timestamp = strftime("%H:%M:%S")
class Curl():
def __init__(self):
self.host = str(''.join(['http://localhost/service/']))
self.token = ""
import requests, json
from time import strftime
timestamp = strftime("%H:%M:%S")
class Curl():
def __init__(self):
self.host = str(''.join(['http://localhost/service/']))
self.token = ""
@d30jeff
d30jeff / index.php
Created June 2, 2015 08:23
Generate PDF
<?php
$file = 'Linux.pdf';
$filename = 'Linux.pdf';
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
<?php
function MultiTable($number_range, $multiple_range){
$number = 0;
for ($i=1; $i<=$number_range; $i++){
$text = "";
$number++;
@d30jeff
d30jeff / listings.txt
Created June 10, 2015 04:47
Lists from 500 pages
No: 1
Name: wannabe toys
Number: 0146589868
Location: Sabah - Kota Kinabalu
No: 2
Name: DeirdreLicious Closet
Number: 0168449118
Location: Sabah - Kota Kinabalu
@d30jeff
d30jeff / log.py
Created June 21, 2015 02:14
Get request for CSV
class LogCSV(object):
"""CSV generator.
This class responds to GET methods.
"""
def on_get(self, req, resp):
"""Generates CSV for log."""
mylist = [
'one','two','three'
]
# -*- coding: utf-8 -*-
#
# Copyright 2013-2014 Codebless Solutions. All rights reserved.
# Copyright 2015 Ik-Huan (Sabah) Sdn. Bhd. All rights reserved.
#
# This file is part of Monserver System.
"""Resources for log."""
from datetime import datetime
csv_data = ""
for x in json_format:
csv_data += str(x['name']) + str(x['flowrate']) + str(x['temperature']) + str(x['power']) + str(x['log_time']) + str(x['created_on'])
@d30jeff
d30jeff / myfile.py
Created June 28, 2015 01:39
Stackoverflow request help
# Function files:
def convert_to_csv(json_format):
"""Converts json to csv."""
csv_data = ""
if json_format:
for x in json_format:
csv_data += str(x['name']) + "," + str(x['flowrate']) + "," + str(x['temperature']) + "," + str(x['power']) + "," +str(x['log_time']) + "," + str(x['created_on']) + "\n"
return csv_data
#include <stdio.h>
#include <time.h>
int main()
{
time_t mytime;
mytime = time(NULL);
printf(ctime(&mytime));
return 0;