Skip to content

Instantly share code, notes, and snippets.

using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
namespace GameCommon.Pooling
{
public class ByteArrayPool
{
private const int MaxArrayLength = 512;
private const int MaxRentTime = 1000; // in milliseconds
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active March 9, 2026 19:36
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@doron2402
doron2402 / memwatch_detect.js
Created May 4, 2017 19:12
Using memwatch-next in order to detect memory leak node 6.10.x
'use strict';
const Memwatch = require('memwatch-next');
const Util = require('util');
if (Config.env === 'production') {
/**
* Check for memory leaks
*/
let hd = null;
Memwatch.on('leak', (info) => {
@jdowning
jdowning / git-pack-size.sh
Created February 23, 2017 02:33
git-cleanup
# BEFORE
/tmp/git-cleanup/repo.git $ git count-objects -v
count: 0
size: 0
in-pack: 204529
packs: 1
size-pack: 574968
prune-packable: 0
garbage: 0
size-garbage: 0
input {
file {
path => ["/data/metricslog/alive/*.log"]
start_position => "beginning"
type => "metrics-alive"
}
file {
@ondrej-kvasnovsky
ondrej-kvasnovsky / commands.md
Last active April 25, 2020 19:43
Commands to install and configure ElasticSearch on Ubuntu

Install ElasticSearch and Java

1  wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.deb
2  sudo dpkg -i elasticsearch-1.0.1.deb
3  sudo update-rc.d elasticsearch defaults 95 10
4  sudo add-apt-repository ppa:webupd8team/java
5  sudo apt-get update
6  sudo apt-get install oracle-java7-installer
7  java -version
// "Extend" the EventEmitter like this:
var EventEmitter = require('events').EventEmitter;
EventEmitter.prototype.once = function(events, handler){
// no events, get out!
if(! events)
return;
// Ugly, but helps getting the rest of the function
@rottmanj
rottmanj / gist:3428098
Created August 22, 2012 18:17
nginx + unicorn
upstream unicorn-staging {
server unix:/data/appname/staging/current/tmp/sockets/unicorn-staging.sock fail_timeout=0;
}
server {
listen 80 deferred;
listen 443;
ssl on;
root /data/appname/staging/current/public;
server_name foo;
@mikhailov
mikhailov / 0. nginx_setup.sh
Last active August 29, 2025 05:48
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@noahhendrix
noahhendrix / api.rb
Created December 22, 2011 09:38
Authenticating with Grape
module Todo
class API < Grape::API
use Rack::Session::Cookie
version 'v1', :format => :json
helpers do
def current_user
return nil if env['rack.session'][:user_id].nil?
@current_user ||= User.get(env['rack.session'][:user_id])
end