Skip to content

Instantly share code, notes, and snippets.

View Tim-CYLiao's full-sized avatar
💭
I may be slow to respond.

Tim Liao Tim-CYLiao

💭
I may be slow to respond.
  • Taiwan
View GitHub Profile
@mprajwala
mprajwala / import_csv_to_mongo
Last active July 23, 2023 20:07
Store CSV data into mongodb using python pandas
#!/usr/bin/env python
import sys
import pandas as pd
import pymongo
import json
def import_content(filepath):
mng_client = pymongo.MongoClient('localhost', 27017)
@StevenMaude
StevenMaude / convert_gpx.sh
Last active January 29, 2023 17:29
Use gpsbabel to convert Garmin .FIT to .gpx — requires a fairly recent version of gpsbabel (minimum 1.4.3); see https://www.stevenmaude.co.uk/posts/using-garmin-forerunner-watches-with-linux for more details on using Garmin watches with Linux
#!/bin/sh
# Usage: convert_gpx.sh <FIT filename>
# Should works whether you include the .FIT extension or not.
filename=$(basename "$1" .FIT)
gpsbabel -i garmin_fit -f "$filename".FIT -o gpx -F "$filename".gpx
@cyyeh
cyyeh / max_binary_heap.py
Created September 6, 2018 04:56
max_binary_heap.py
class MaxBinaryHeap:
def __init__(self, values=[]):
self.values = values
self.build_max_heap()
def max(self):
"""return first element in the array"""
if len(self.values) > 0:
return self.value[0]
else: