Skip to content

Instantly share code, notes, and snippets.

@yatt
yatt / tesseract-ocr-class.cs
Created April 12, 2011 12:49
simple c# class for Optical Character Recognition(OCR) using tesseract (http://code.google.com/p/tesseract-ocr/) usage: pass .exe path to constructor
// usage:
//
// TesseractOCR ocr = TesseractOCR(@"C:\bin\tesseract.exe");
// string result = ocr.OCRFromBitmap(bmp);
// textBox1.Text = result;
//
using System;
using System.IO;
using System.Diagnostics;
using System.Drawing;
@turicas
turicas / example_image_utils.py
Created December 10, 2011 19:04
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@aspyct
aspyct / signal.c
Last active February 19, 2024 11:24
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* a.dotreppe@aspyct.org
* http://aspyct.org
*
* Hope it helps :)
*/
#include <stdio.h>
#include <stdlib.h>
@willurd
willurd / web-servers.md
Last active May 17, 2024 16:24
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@stamat
stamat / HashCache.js
Last active February 19, 2016 00:19
A hash table value value storage for quick seek in large lists of big objects/arrays/strings. It uses CRC32 algorithm to convert supplied values into integer hashes and produce more elegant solution escaping data redundancy and heavy memory loads but also leaning on native hash map implementation for seek speed and optimization.
/**
* A hash table value value storage for quick seek in large lists of big objects/arrays/strings.
* It uses CRC32 algorithm to convert supplied values into integer hashes and produce more elegant solution escaping data redundancy and heavy memory loads but also leaning on native hash map implementation for seek speed and optimization.
*
* @author Nikola Stamatovic Stamat < stamat@ivartech.com >
* @copyright ivartech < http://ivartech.com >
* @version 1.0
* @date 2013-07-02
* @namespace ivar.data
*/
Shader "Sprites/Cutout"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.5
}
@ZimM-LostPolygon
ZimM-LostPolygon / UnityGuidRegenerator.cs
Last active February 8, 2024 10:10
Unity asset GUIDs regenerator
// Drop into Assets/Editor, use "Tools/Regenerate asset GUIDs"
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using UnityEditor;
namespace UnityGuidRegenerator {
public class UnityGuidRegeneratorMenu {
@mstevenson
mstevenson / FindReferences.cs
Last active September 24, 2021 04:31
Find Unity objects that reference a selected asset
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class FindReferences : EditorWindow, ISerializationCallbackReceiver
{
List<string> displayedRefs = new List<string>();
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace PvpGame
{
public class GridValue
{
public enum EntityType
@AlexanderDzhoganov
AlexanderDzhoganov / DebugUtil.cs
Created March 14, 2015 14:08
Dump RenderTexture to PNG in Unity
public static class DebugUtil
{
public static void DumpRenderTexture(RenderTexture rt, string pngOutPath)
{
var oldRT = RenderTexture.active;
var tex = new Texture2D(rt.width, rt.height);
RenderTexture.active = rt;
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);