Skip to content

Instantly share code, notes, and snippets.

View ksindi's full-sized avatar
🚀
Shipping

Kamil Sindi ksindi

🚀
Shipping
View GitHub Profile
@ksindi
ksindi / promises.md
Created April 14, 2017 16:00 — forked from domenic/promises.md
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@ksindi
ksindi / conftest.py
Created April 28, 2017 02:49 — forked from billyshambrook/conftest.py
Categorise integration tests using PyTest.
import pytest
def pytest_addoption(parser):
parser.addoption("--integration", action="store_true", help="run integration tests")
def pytest_runtest_setup(item):
if 'integration' in item.keywords:
if not item.config.getoption("--integration"):
import asyncio
async def bar(i):
print('started', i)
await asyncio.sleep(1)
print('finished', i)
if i == 5:
raise ValueError("Foo")
return i
@ksindi
ksindi / pdfmod.py
Created July 15, 2017 13:51 — forked from jrsmith3/pdfmod.py
Convert specified pages from a PDF to png
"""
This script was used to create the figures for http://jrsmith3.github.io/sample-logs-the-secret-to-managing-multi-person-projects.html from a PDF file containing some old CMU sample logs.
"""
import PyPDF2
from wand.image import Image
import io
import os
@ksindi
ksindi / pypdf_to_image.py
Created July 15, 2017 16:05 — forked from rririanto/pypdf_to_image.py
Python Convert PDF to Image
"""
Problem:
How to Convert PDF to Image with Python Script ?
Installation:
I use ubuntu OS 14.04
We use wrapper for ImageMagick [http://www.imagemagick.org/script/index.php] to Convert The PDF file
in Python do:
$ sudo apt-get install libmagickwand-dev
@ksindi
ksindi / imagemagick-install-steps
Created July 16, 2017 03:36 — forked from rodleviton/imagemagick-install-steps
Installing Image Magick on Ubuntu 14.04
sudo -i
cd
apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
wget http://www.imagemagick.org/download/ImageMagick-6.8.7-7.tar.gz
tar xzvf ImageMagick-6.8.9-1.tar.gz
cd ImageMagick-6.8.9-1/
./configure --prefix=/opt/imagemagick-6.8 && make
checkinstall
@ksindi
ksindi / git_size.sh
Last active February 23, 2024 15:12
Versioned files in human readable format sorted by size
git ls-tree -rz --name-only HEAD -- | xargs -0 du -kh | sort -sh -k 1,1
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
fields = [
pa.field('column1', pa.string()),
pa.field('column2', pa.int64()),
pa.field('column3', pa.string()),
]
import os
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
NUM_FIELDS = 600
NUM_TABLES = 100
fields = [
"""
Dockerfile
FROM python:3.6
RUN apt-get install -y ghostscript \
libmagickwand-dev
RUN pip install wand PyPDF2