Skip to content

Instantly share code, notes, and snippets.

View ahirner's full-sized avatar

Alexander Hirner ahirner

View GitHub Profile
@DGriffin91
DGriffin91 / bevy_texture_to_png.rs
Last active January 5, 2024 20:12
Bevy Texture to PNG
// License: Apache-2.0 / MIT
use bevy::core_pipeline::{
draw_3d_graph, node, AlphaMask3d, Opaque3d, RenderTargetClearColors, Transparent3d,
};
use bevy::prelude::*;
use bevy::reflect::TypeUuid;
use bevy::render::camera::{ActiveCamera, CameraTypePlugin, RenderTarget};
use bevy::render::render_asset::RenderAssets;
use bevy::render::render_graph::{NodeRunError, RenderGraph, RenderGraphContext, SlotValue};
import networkx as nx
import itertools
def transitive_closure_compression(g):
# For a given DAG return a smaller (edge count) DAG with additional nodes
# and a transitive closure that has the transitive closure of the original
# DAG as induced subgraph.
# It does this by generating a contraction hierachy (CH) and building a new
@alsrgv
alsrgv / pytorch_imagenet_resnet50_1late.py
Created July 27, 2018 18:35
1-late SGD for PyTorch ImageNet example with Horovod
from __future__ import print_function
import argparse
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data.distributed
from torchvision import datasets, transforms, models
import horovod.torch as hvd
import tensorboardX
@BigEpsilon
BigEpsilon / resize_dir.nim
Created October 7, 2017 21:00
Calling OpenCV from Nim
import os
{.link: "/usr/local/lib/libopencv_core.so".} #pass arguments to the linker
{.link: "/usr/local/lib/libopencv_highgui.so".}
{.link: "/usr/local/lib/libopencv_imgproc.so".}
const # headers to include
std_vector = "<vector>"
cv_core = "<opencv2/core/core.hpp>"
cv_highgui = "<opencv2/highgui/highgui.hpp>"
@zacharycarter
zacharycarter / wclwn.md
Last active May 22, 2025 15:00
Binding to C Libraries with Nim
@ElijahLynn
ElijahLynn / pipe_to_docker_examples
Last active July 2, 2024 01:27
How to pipe to `docker exec` examples
# These examples assume you have a container currently running.
# 1 Pipe from a file
sudo docker exec --interactive CONTAINER_NAME /bin/bash < the_beginning.sh | tee the_beginning_output.txt`
#2a Pipe by piping
echo "echo This is how we pipe to docker exec" | sudo docker exec --interactive CONTAINER_NAME /bin/bash -
@chiral
chiral / trivial_opt_ceres.cpp
Created December 2, 2015 15:19
example of trivial optimization problem on 2-d circle for the purpose of comparison between ceres-solver and TensorFlow
#include "ceres/ceres.h"
#include "glog/logging.h"
using ceres::CostFunction;
using ceres::AutoDiffCostFunction;
using ceres::Problem;
using ceres::Solver;
using ceres::Solve;
struct CostFunctor {
@tokestermw
tokestermw / preprocess-twitter.py
Last active January 2, 2023 07:16
Python version of Ruby script to preprocess tweets for use in GloVe featurization http://nlp.stanford.edu/projects/glove/
"""
preprocess-twitter.py
python preprocess-twitter.py "Some random text with #hashtags, @mentions and http://t.co/kdjfkdjf (links). :)"
Script for preprocessing tweets by Romain Paulus
with small modifications by Jeffrey Pennington
with translation to Python by Motoki Wu
Translation of Ruby script to create features for GloVe vectors for Twitter data.