Skip to content

Instantly share code, notes, and snippets.

View CyberShadow's full-sized avatar

Vladimir Panteleev CyberShadow

View GitHub Profile
diff --git a/search.cpp b/search.cpp
index 27eca9f..83b837b 100644
--- a/search.cpp
+++ b/search.cpp
@@ -408,15 +408,17 @@ void* ramEnd = (char*)ram + RAM_SIZE;
#define ALL_FILE_BUFFER_SIZE 0
#endif
-struct CompressedState_packed
+struct PackedCompressedState
@CyberShadow
CyberShadow / hookexample.cpp
Created April 16, 2010 20:37
madCodeHook method hooking example
class MyObject;
int (MyObject::*origFunction)(int);
class MyObject
{
public:
int funcHandler(int param)
{
// do hooked stuff
#!/usr/bin/env python
USERNAME = "thecybershadow" # don't include @gmail.com
PASSWORD = "hunter2"
RESOURCE = "gmail.com"
import sys
if len(sys.argv) < 2:
print 'Usage: python gstatus.py <show> [<status>]'
module AddPNGChunk;
import std.file;
import Data, PNG;
void main(string[] args)
{
if (args.length != 4)
throw new Exception("Usage: AddPNGChunk Image.png ChunkID Filename.ext");
@CyberShadow
CyberShadow / test.d
Created October 18, 2010 00:06
binary search benchmarks
import std.range;
import std.random;
import std.stdio;
int[1000] a;
void main()
{
foreach (ref n; a)
n = rand()%1000;
@CyberShadow
CyberShadow / rdmd.d
Created May 26, 2011 21:16
DustMite output - before
// Written in the D programming language.
import std.algorithm, std.c.stdlib, std.datetime, std.exception,
std.file, std.getopt,
std.md5, std.path, std.process, std.regexp,
std.stdio, std.string, std.array, std.typetuple;
private bool chatty, buildOnly, dryRun, force;
private string exe, compiler = "dmd";
@CyberShadow
CyberShadow / rdmd.d
Created May 26, 2011 21:16
DustMite output - after
import std.algorithm, std.array, std.typetuple;
int main()
{
const
root =[];
replace(root, ".", "-");
}
import std.stdio, std.string, std.exception;
void main(string[] args)
{
enforce(args.length==3, "Two files please");
auto f1 = File(args[1]), f2 = File(args[2]);
while (!f1.eof() && !f2.eof())
{
auto l1 = f1.readln(), l2 = f2.readln();
@CyberShadow
CyberShadow / gist:1189548
Created September 2, 2011 19:10
pre-commit hook
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
# This is slightly modified from Andrew Morton's Perfect Patch.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{
FILE *f;
char *cc, cmdline[1024];
if (argc != 3)
return fprintf(stderr, "Usage: %s header.h VALUE\n", argv[0]);