Skip to content

Instantly share code, notes, and snippets.

View borja-munoz's full-sized avatar

borja-munoz

View GitHub Profile
// clear the back buffer to black for the new frame
device_ptr->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
device_ptr->BeginScene();
// select which vertex format we are using
device_ptr->SetFVF(CUSTOMFVF);
// select the vertex buffer to display
device_ptr->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.5f, -0.5f, 0.0f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(-0.5f, -0.5f, 0.0f);
@borja-munoz
borja-munoz / hello_world_red_book.c
Created November 13, 2021 15:17
Hello World - OpenGL Programming Guide
#include <whateverYouNeed.h>
main() {
InitializeAWindowPlease();
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0, 1.0, 1.0);
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
@borja-munoz
borja-munoz / execute_statement_redshift.py
Created May 2, 2021 16:30
Execute SQL stamement using Redshift Data API
import logging
import boto3
from botocore.exceptions import ClientError
client = boto3.client('redshift-data')
try:
# Execute the SQL statement
query_response = client.execute_statement(
ClusterIdentifier=cluster_identifier,
@borja-munoz
borja-munoz / uploadFileS3.py
Last active May 2, 2021 13:17
Upload file to AWS S3 bucket
import logging
import boto3
from botocore.exceptions import ClientError
s3_client = boto3.client('s3')
try:
response = s3_client.upload_file(file_name, bucket, file_name)
except ClientError as e:
logging.error(e)
@borja-munoz
borja-munoz / createCSVwithEWKB.py
Created May 2, 2021 11:01
Read geospatial file with Fiona and write CSV file with EWKB geometries using Shapely
import csv
import logging
import fiona
from shapely import geos, wkb
from shapely.geometry import shape
output_file = file_name + ".processing.csv"
with fiona.open(file_name, "r") as source: