Skip to content

Instantly share code, notes, and snippets.

View goldsborough's full-sized avatar
🔨
Fixing things

Peter Goldsborough goldsborough

🔨
Fixing things
View GitHub Profile
// Clang includes
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Rewrite/Frontend/FixItRewriter.h"
@goldsborough
goldsborough / toy.py
Last active August 9, 2017 04:09
Generate Toy Images for Object Detection
#!/usr/bin/env python3
import argparse
import math
import numpy as np
import scipy.misc
import time
def generate_rectangle(x_0, y_0, width, height, color, max_dimension):
import os
import keras.backend as K
import matplotlib.pyplot as plot
import numpy as np
import tensorflow as tf
from keras.datasets import mnist
from keras.initializers import TruncatedNormal
from keras.layers import (Activation, BatchNormalization, Conv2D,
Conv2DTranspose, Dense, Input, LeakyReLU,
import keras.backend as K
import matplotlib.pyplot as plot
import numpy as np
import tensorflow as tf
from keras.datasets import mnist
from keras.layers import (Activation, BatchNormalization, Conv2D, Dense,
Flatten, Input, LeakyReLU, Reshape, UpSampling2D)
from keras.models import Model
from keras.optimizers import Adam
#include <cudnn.h>
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <opencv2/opencv.hpp>
cv::Mat load_image(const char* image_path) {
cv::Mat image = cv::imread(image_path, CV_LOAD_IMAGE_COLOR);
image.convertTo(image, CV_32FC3);
cv::normalize(image, image, 0, 1, cv::NORM_MINMAX);
@goldsborough
goldsborough / conv.cu
Last active February 2, 2025 09:14
Convolution with cuDNN
#include <cudnn.h>
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <opencv2/opencv.hpp>
#define checkCUDNN(expression) \
{ \
cudnnStatus_t status = (expression); \
if (status != CUDNN_STATUS_SUCCESS) { \
@goldsborough
goldsborough / notes.md
Last active October 6, 2017 20:07
Google Cloud Setup Notes

Setting Up Google Cloud

Installing GCloud

Install Google Cloud's CLI, gcloud, on your machine: https://cloud.google.com/sdk/downloads Just grab a version and wget it. Then run instructions on the website to install.

Install gsutil: pip install gsutil. Authenticate: gsutil config.

@goldsborough
goldsborough / setup.sh
Created October 6, 2017 20:05
Google Cloud VM Setup Script
#!/bin/bash
# Basic environment stuff
sudo apt-get install -y \
software-properties-common apt-utils build-essential linux-headers-$(uname -r)
# NVIDIA Drivers
sudo add-apt-repository ppa:graphics-drivers/ppa -y
sudo apt-get update
"*":
Repl: {}
"activate-power-mode":
autoToggle: false
"atom-beautify":
c:
default_beautifier: "clang-format"
cpp:
default_beautifier: "clang-format"
general:
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#