This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void reverse() { | |
int c; | |
c = getchar(); | |
if (c != '\n') | |
reverse(); | |
putchar(c); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#define swap(x, y) do \ | |
{ unsigned char swap_temp[sizeof(x) == sizeof(y) ? (signed)sizeof(x):-1];\ | |
memcpy(swap_temp, &y, sizeof(x)); \ | |
memcpy(&y, &x, sizeof(x)); \ | |
memcpy(&x, swap_temp, sizeof(x)); \ | |
} while(0) | |
// this snippet from stackoverflow | |
// http://stackoverflow.com/questions/3982348/implement-generic-swap-macro-in-c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static char digits[19] = { '9', '8', '7', '6', '5', | |
'4', '3', '2', '1','0', '1', '2', '3', '4', '5', | |
'6', '7', '8', '9' }; | |
static const char* zero = digits + 9; | |
printf( "%c\n", zero[-1] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
字符'0'在机器中存放的是其ASCII码,‘0‘对应的是0x30,以二进制表示“00110000”。 | |
从’0’-‘9’对应的ASCII码为0x30-0x39,并且在数值上,分别对应后四位二进制所表示 | |
的数值,如‘1’->0x31->00110001,后四位为0001。所以可以使用移位来得到后四位, | |
然后根据十进制的性质,每次×10逐步得到结果。 | |
*/ | |
long c2i (char str[]) { | |
long b = 0; | |
while(*str != '\0') { | |
b = b*10 + ((unsigned char)((char)(*(str++)<<4))>>4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
******************************************************************************* | |
* WarCraft III Replay file format description * | |
* * | |
* document version: 1.18 * | |
* document date : 2007-06-26 * | |
* document authors: blue, nagger * | |
* * | |
* For more informtion about w3g file format, please visit: * | |
* http://w3g.deepnode.de * | |
* * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$f = $ARGV[0]; | |
$pagestart = 0; | |
$charstart = 0; | |
$kernstart = 0; | |
$s = "<?xml version=\"1.0\"?>\n<font>\n"; | |
open(F, $f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From http://forum.unity3d.com/threads/solved-dynamic-blurred-background-on-ui.345083/ | |
Shader "Custom/SimpleGrabPassBlur" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_BumpAmt ("Distortion", Range (0,128)) = 10 | |
_MainTex ("Tint Color (RGB)", 2D) = "white" {} | |
_BumpMap ("Normalmap", 2D) = "bump" {} | |
_Size ("Size", Range(0, 20)) = 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
_ooOoo_ | |
o8888888o | |
88" . "88 | |
(| -_- |) | |
O\ = /O | |
____/`---'\____ | |
.' \\| |// `. | |
/ \\||| : |||// \ | |
/ _||||| -:- |||||- \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
$f = $ARGV[0]; | |
$pagestart = 0; | |
$charstart = 0; | |
$kernstart = 0; | |
$s = "<?xml version=\"1.0\"?>\n<font>\n"; | |
open(F, $f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IEnumerator Waiting(TimeSpan elapsedTimeSpan, | |
System.Action<TimeSpan> timeCallback, | |
System.Action callback) | |
{ | |
for (;elapsedTimeSpan.CompareTo(TimeSpan.Zero) >= 0;) | |
{ | |
if (timeCallback != null) { timeCallback(elapsedTimeSpan); } | |
elapsedTimeSpan -= new TimeSpan(0, 0, 1); | |
yield return new WaitForSeconds(1.0f); |
OlderNewer