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
struct div_result { | |
int z1; | |
int z2; | |
}; | |
/*@ requires x1 >= 0; | |
requires x2 > 0; | |
ensures \result.z1 * x2 + \result.z2 == x1; | |
ensures 0 <= \result.z2 <= x2; | |
*/ | |
struct div_result div(int x1, int x2) { |
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
+-----------+-------------+----------+----------+----------+----------+----------+----------+---------+ | |
| no. bytes | bits for cp | first cp | last cp | byte 0 | byte 1 | byte 2 | byte 3 | cps | | |
+-----------+-------------+----------+----------+----------+----------+----------+----------+---------+ | |
| 1 | 7 | U+0000 | U+007F | 0xxxxxxx | | | | 127 | | |
| | | | | 0-7F | | | | | | |
+-----------+-------------+----------+----------+----------+----------+----------+----------+---------+ | |
| 2 | 11 | U+0080 | U+07FF | 110xxxxx | 10xxxxxx | | | 1919 | | |
| | | | | C0-DF | 80-BF | | | | | |
+-----------+-------------+----------+----------+----------+----------+----------+----------+---------+ | |
| 3 | 16 | U+0800 | U+FFFF | 1110xxxx | 10xxxxxx | 10xxxxxx | |
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 <fstream> | |
int S(int n) { | |
return n == 1 ? 1 : 2 * S(n - 1) + 1; | |
} | |
int main() { | |
int n; | |
printf("Enter n: "); | |
scanf("%d", &n); |
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 System.Random | |
import Data.List (delete,unwords) | |
data Chord = D | A | E | Dm | Am | Em | G | C | |
deriving (Show, Enum, Eq, Ord) | |
allChords = [D .. C] | |
combinations :: [Chord] -> [(Chord,Chord)] | |
combinations [] = [] |
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 "get.hpp" | |
void Get_init() | |
{ | |
curl = curl_easy_init(); | |
if (!curl) | |
throw std::runtime_error("curl_easy_init() failed"); | |
} | |
static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, |
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
SUBROUTINE F(X, Y, J) F 00010 | |
COMMON/A1/M1,N F 00020 | |
COMMON/A10/NF F 00030 | |
DOUBLE PRECISION X(N), Y(M1) F 00040 | |
F 00050 | |
IF (.NOT.(J.EQ.0.OR.J.EQ.-1)) GO TO 1 F 00060 | |
Y(M1) = 3*(X(1)**2) - 2*X(2) F 00070 | |
NF = NF+1 F 00080 | |
1 IF (.NOT.(J.EQ.1.OR.J.EQ.-1)) GO TO 2 F 00090 | |
Y(1) = 2*X(1) + X(2) - 4 F 00100 |
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
this gist contains dotfiles: .zshrc.local, .xinitrc, .conkyrc, .Xresources and .ctags | |
dwm distro: dl.dropboxusercontent.com/u/84285293/distro.tar.bz2 |
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 Data.List (delete, nub, intersperse) | |
import System.IO (hFlush, stdout) | |
import System.Random | |
import System.Exit | |
import Control.Monad (when) | |
data Suit = Spades | Clubs | Hearts | Diamonds deriving (Eq) | |
data Rank = Number Int | Jack | Queen | King | Ace deriving (Eq) | |
type Card = (Rank, Suit) |
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 <queue> | |
#include <vector> | |
#include <memory> | |
#include <cstdarg> | |
using namespace std; | |
class Tree { | |
public: |
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 Data.Char (chr) | |
modifyAt :: Num a => Int -> [a] -> (a -> a) -> [a] | |
modifyAt pos list func = let splitList = splitAt pos list | |
(x:xs) = snd splitList | |
in (fst splitList) ++ [func x] ++ xs | |
data BFstate = BFstate { tape :: [Integer], | |
tapePtr :: Int, | |
output :: [Char] } |
NewerOlder