Skip to content

Instantly share code, notes, and snippets.

View danilogr's full-sized avatar

Danilo Gasques danilogr

View GitHub Profile
@danilogr
danilogr / 3DPointsFromDepth.swift
Created February 8, 2022 18:13 — forked from snowzurfer/3DPointsFromDepth.swift
3D world points from ARKit depth
import ARKit
import SceneKit
let horizontalPoints = 256 / 2
let verticalPoints = 192 / 2
var depthNodes = [SCNNode]()
var parentDebugNodes = SCNNode()
var sceneView: ARSCNView!
// Somewhere during setup
@danilogr
danilogr / nasa_perseverance_apritags.ipynb
Created February 22, 2021 20:33
Finding AprilTag markers in Mars! NASA's rover Perseverance uses AprilTags!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danilogr
danilogr / encrypted-git-repo.md
Created June 5, 2018 21:42
Transparent Git Encryption

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang (geek@cerias.net). It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].

Description

When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

@danilogr
danilogr / savepicture.py
Created February 18, 2018 08:08
Microsoft Kinect Timelapse: saves a picture every minute
'''
This script uses PyKinectV2 to capture Microsoft Kinect v2 frames,
and OpenCV (>=2) to save those as JPG images every minute.
Dependencies: PyKinectV2 (https://github.com/Kinect/PyKinect2/) and OpenCV.
Running the script
1) Make sure that you have a 32 bit version of Python. PyKinectV2 does not run on the 64 bit alternative.
If you need to install python on Windows, consider using Anaconda.
2) Install OpenCV using conda
@danilogr
danilogr / imgui_node_graph_test.cpp
Created July 22, 2017 05:39 — forked from ocornut/imgui_node_graph_test.cpp
Node graph editor basic demo for ImGui
// Creating a node graph editor for ImGui
// Quick demo, not production code! This is more of a demo of how to use ImGui to create custom stuff.
// Better version by @daniel_collin here https://gist.github.com/emoon/b8ff4b4ce4f1b43e79f2
// See https://github.com/ocornut/imgui/issues/306
// v0.02
// Animated gif: https://cloud.githubusercontent.com/assets/8225057/9472357/c0263c04-4b4c-11e5-9fdf-2cd4f33f6582.gif
// NB: You can use math functions/operators on ImVec2 if you #define IMGUI_DEFINE_MATH_OPERATORS and #include "imgui_internal.h"
// Here we only declare simple +/- operators so others don't leak into the demo code.
static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); }
@danilogr
danilogr / async_http_server.cpp
Last active March 2, 2024 10:34
Asynchronous HTTP server written in C++ using boost::asio
/**
* danilod100 at gmail.com
* Compile with: g++ async_http_server.cpp -o async_http_server -lboost_system -lboost_thread -lpthread
*
* */
#include <iostream>
#include <ostream>
#include <istream>
#include <ctime>

Keybase proof

I hereby claim:

  • I am danilogr on github.
  • I am dnl (https://keybase.io/dnl) on keybase.
  • I have a public key whose fingerprint is 15FA 49B5 0431 42FF E5B5 A9E1 3D62 0EED 17DB 3222

To claim this, I am signing this object:

@danilogr
danilogr / encoder_test.cpp
Last active July 27, 2016 17:32
x264 encoding times
/*
* This gist is based on the original example.c provided by libx264's source
* code. It's slightly modified so that it can use some of c++11 latest features
* (e.g.: chronos lib, std::bind and std::function).
* It also encodes the last frame as many times as there are frames in the input
* file so that it can compare the avg encoding time for these two different situations
* (video with movements vs static image repeated many times)
*
* # Requirements:
* (Tested with) libx264 0.148.2597M e86f3a1
@danilogr
danilogr / exercise-loops-and-functions.go
Created June 30, 2015 20:14
A Tour of Go: Square root using Netwon's method
// https://tour.golang.org/flowcontrol/8
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) (z float64) {
const delta float64 = 1e-10