Skip to content

Instantly share code, notes, and snippets.

View jappa's full-sized avatar

Jamil Appa jappa

View GitHub Profile
@liyang85105
liyang85105 / print_macro.cc
Created August 15, 2017 03:14
print macro(#define macro ...)'s value when using gcc/g++
/* Some test definition here */
#define DEFINED_BUT_NO_VALUE
#define DEFINED_INT 3
#define DEFINED_STR "ABC"
/* definition to expand macro then apply to pragma message */
#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
@brendancol
brendancol / rasterio_datashader_polygons.py
Last active December 17, 2020 21:43
Datashader + Rasterio for Polygon shading (40K Polygons, 81M Vertices)
from __future__ import division
from functools import partial
import pyproj
from shapely.ops import transform
import numpy as np
from rasterio import features
from affine import Affine
import fiona
@minrk
minrk / nbstripout
Last active June 6, 2023 06:23
git pre-commit hook for stripping output from IPython notebooks
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
LICENSE: Public Domain
@garnaat
garnaat / iam_ec2_example.py
Created September 15, 2010 04:48
Use IAM/boto to provide access to EC2 and S3
"""
IAM boto examples:
In this example we create a group that provides access
to all EC2 and S3 resources and actions and then add a
user to that group.
"""
import boto
#
# First create a connection to the IAM service