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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
;dimensions of square world |
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 <iostream> | |
enum stuff { | |
laugh, | |
strike, | |
slap, | |
}; | |
struct true_ {}; | |
struct false_ {}; |
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
/** | |
* Compile with GCC 4.9: | |
* g++ -std=c++1y lisp.cpp | |
*/ | |
#include <iostream> | |
#include <stdio.h> | |
auto terminal = [] (auto stream) { | |
return [=] (auto func) { | |
return func (stream); |
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
function Send-NetworkData { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory)] | |
[string] | |
$Computer, | |
[Parameter(Mandatory)] | |
[ValidateRange(1, 65535)] | |
[Int16] |
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
private InputFilter getCharactersLimited() { | |
// Limit characters input | |
InputFilter[] filters = new InputFilter[1]; | |
filters[0] = new InputFilter(){ | |
@Override | |
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { | |
if (end > start) { | |
char[] acceptedChars = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', |
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
/** | |
* The array contains a set of unsorted numbers. All numbers appear an even number of | |
* times. The exception is two numbers, call them M and N, which appear an odd number of | |
* times. Find M and N. | |
* | |
* This solution is O(n), where n is the size of the array. It requires two passes over | |
* the array. | |
* | |
* The generalised version of this problem (N elements, one number repeats K times) can | |
* be reduced to solving the linear system of equations: |
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
; 0x400cb0: | |
mov rax,qword [rbp-0x20] | |
add qword [rbp+0x10],rax | |
add qword [rbp+0x18],rax | |
add qword [rbp+0x20],rax | |
add qword [rbp+0x28],rax | |
add qword [rbp-0x8],rax | |
jmp 0x3f |
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
; 0x401348: | |
jmp 0x145 ; these clothes are a little tight, but the price was right |
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
; 0x400ef8: | |
mov rax,qword [rbp+0x20] | |
mov edx,eax | |
sar edx,0x1f | |
xor eax,edx | |
sub eax,edx | |
cdqe | |
mov qword [rbp-0x8],rax | |
imul rax,qword [rbp+0x18] | |
add qword [rbp+0x10],rax |
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
; 0x4010e9: | |
mov rax,qword [0x601d38] | |
imul rax,rax,0xf7733c1 | |
add qword [rbp-0x8],rax | |
add qword [rbp-0xc],0xf7733c1 | |
mov rax,qword [rbp-0x8] | |
xor rdx,rdx | |
mov rcx,0x10bebc1fb ; the # in 2's complement from the original | |
div rcx | |
mov qword [rbp-0x8],rdx |
OlderNewer