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> | |
#include <boost/thread.hpp> | |
using namespace std; | |
using boost::thread; | |
using boost::mutex; | |
using boost::shared_lock; | |
using boost::shared_mutex; | |
using boost::upgrade_lock; | |
using boost::upgrade_to_unique_lock; |
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
# Please note, this is not my work, but the work of a fellow redditer. | |
# I am simply placing it here for future use. | |
def MillerRabin(n,k=5): | |
''' | |
Performs the Miller-Rabin primality test on n to an error bound of 4^-k | |
(i.e. performs the test k times). True indicates a probable prime while a | |
false result indicates a definite composite number. | |
Inputs: | |
n - Number to be tested for primality |
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
<head> | |
<link rel="stylesheet" type="css" href="css/tab.css" /> | |
<script src="js/tab.js" type="text/javascript"></script> | |
</head> | |
<body> | |
<div class="tab-wrapper"> | |
<div class="tab-button-wrapper"> | |
<ul> | |
<li><a class="tab-button-first" | |
id="tab-button1" |
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
; ------------------------ | |
; reverse.asm - Reverse a string without copying it | |
; Max length of string is 64 bytes | |
; This is for an x86_64 Linux System | |
; Assemble with: | |
; yasm -f elf64 reverse.asm | |
; Link with: | |
; ld -o reverse reverse.o | |
; Note: Also perfectly capable of swapping yasm for nasm without changing code | |
; ------------------------ |
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> | |
#include <boost/thread.hpp> | |
using namespace std; | |
using boost::thread; | |
using boost::mutex; | |
mutex a; | |
const int THREAD_COUNT = 10; |
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
data Parser = WebParser | DbParser | |
class ParseStrategy p where | |
parse :: p -> String -> String | |
instance ParseStrategy Parser where | |
parse WebParser s = "code for parsing web stuff goes here" | |
parse DbParser s = "code for parsing db stuff goes here" | |
fromDB = parse DbParser |
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
filetype plugin on | |
filetype plugin indent on | |
syntax on | |
set t_Co=256 | |
set bg=dark | |
colorscheme solarized | |
set backspace=indent,eol,start |
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
bd = branch --delete | |
bm = branch --merged | |
cbr = rev-parse --abbrev-ref HEAD | |
cm = commit -m | |
co = checkout | |
cob = checkout -b | |
comit = commit | |
g = grep --break --heading --line-number | |
lol = log --pretty=oneline --abbrev-commit --graph --decorate | |
ship = push |
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
sealed class Either<out L, out R> { | |
data class Left<out L>(val l: L) : Either<L, Nothing>() | |
data class Right<out R>(val r: R) : Either<Nothing, R>() | |
} | |
fun asdf() { | |
val p = Promise<Int> { resolve, reject -> | |
resolve(Either.Left(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
import android.databinding.BindingAdapter | |
import android.support.design.widget.TextInputEditText | |
import android.support.design.widget.TextInputLayout | |
data class FormData<out D, R>( | |
val data: D, | |
val reason: R?, | |
private val _reasonToString: (R?) -> String = { "$it" } | |
) { | |
val isValid = reason != null |
NewerOlder