Skip to content

Instantly share code, notes, and snippets.

Avatar

Nezar Abdennur nvictus

View GitHub Profile
@ajelenak
ajelenak / h5-to-zarr.py
Last active Nov 20, 2020
Python code to extract HDF5 chunk locations and add them to Zarr metadata.
View h5-to-zarr.py
# Requirements:
# HDF5 library version 1.10.5 or later
# h5py version 3.0 or later
# pip install git+https://github.com/HDFGroup/zarr-python.git@hdf5
import logging
from urllib.parse import urlparse, urlunparse
import numpy as np
import h5py
import zarr
@clemsos
clemsos / csv_to_elastic_search_bulk_insert.py
Last active Mar 10, 2020
Elastic Search : index large csv files with Python Pandas
View csv_to_elastic_search_bulk_insert.py
from pyelasticsearch import ElasticSearch
import pandas as pd
from time import time
root_path="/home/clemsos/Dev/mitras/"
raw_data_path=root_path+"data/"
csv_filename="week10.csv"
t0=time()
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active Nov 22, 2020
how to delete a git tag locally and remote
View git-tag-delete-local-and-remote.sh
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@eric-hu
eric-hu / Open iterm tab here
Last active Sep 10, 2020
Apple script to open an iterm2 tab from right-clicking on a file or folder in Finder. To use: (1) Open Automator (2) Create a new service (3) Change "Service receives selected" drop downs to "Files or folders" in "Finder" (4) Select "Run applescript" from the sidebar, then paste this script in and save
View Open iterm tab here
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set filetype to (kind of (info for my_file))
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer:
@acrosby
acrosby / rtree_large_test.py
Last active May 5, 2017
Sample code for python rtree bulk loading of 10,000,000 points and a nearest neighbor query.
View rtree_large_test.py
from rtree import index
from random import random
from datetime import datetime
timer = datetime.now()
# Create 10,000,000 random numbers between 0 and 1
rands = [random() for i in range(10000000)]
# Function required to bulk load the random points into the index
You can’t perform that action at this time.