Skip to content

Instantly share code, notes, and snippets.

@ebraminio
ebraminio / upload.go
Last active March 22, 2023 06:01
golang upload client and server
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
@ebraminio
ebraminio / main.cc
Created November 20, 2016 15:08
Minimal code to repro hb_coretext memory leak
#include <stdlib.h>
#include <stdio.h>
#include <hb.h>
int main(int argc, char **argv) {
FILE *f = fopen("/Library/Fonts/Tahoma.ttf", "rb");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
@ebraminio
ebraminio / cuda.cu
Last active December 19, 2016 15:13
CUDA capabilities gist
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "device_functions.h"
#include <stdio.h>
void print(char*, int[], int);
__global__ void square(int *a) { // our computation logic, will be run on GPU
a[threadIdx.x] *= a[threadIdx.x];
@ebraminio
ebraminio / kernel.cu
Last active December 19, 2016 17:24
All Sums
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#define __CUDACC__
#include "device_functions.h"
#include <stdio.h>
#include <stdlib.h>
void print(char*, int[], int);
// `clang a.c && time ./a.out`
// real 0m0.071s
// user 0m0.067s
// sys 0m0.002s
// `clang -O3 a.c && time ./a.out`
// real 0m0.029s
// user 0m0.025s
// sys 0m0.001s
// `gcc-6 a.c && time ./a.out`
// real 0m0.093s
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ebraminio
ebraminio / pillowdrawtext.ipynb
Created January 30, 2017 07:13
Pillow Draw Text
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ebraminio
ebraminio / pangocairodrawtext.ipynb
Last active June 23, 2018 09:12
PangoCairo Draw Text
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.