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
{-# LANGUAGE FlexibleContexts, GeneralizedNewtypeDeriving, | |
PatternGuards, ScopedTypeVariables #-} | |
import Control.Concurrent (forkIO) | |
import Control.Concurrent.STM | |
import Control.Exception (catch, finally) | |
import Control.Monad.Error | |
import Control.Monad.State | |
import Data.Char (isControl) | |
import Data.List (nub) |
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
/* | |
* Example of embedding Github gists. | |
*/ |
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 <setjmp.h> | |
#include <signal.h> | |
#include <stdio.h> | |
#include <string.h> | |
void primer(char probe[256]) { | |
// Some specific address | |
int addr = 136322; | |
// This will throw segmentation fault, but we're "catching it" | |
char v = *(char *)addr; |
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
if (bigvalue < a.length) { | |
value = a[bigvalue]; | |
if (value & 1 > 0) { | |
x = a[100]; | |
} else { | |
x = a[200]; | |
} | |
} | |
// Timing attack | |
const t1 = performance.now(); |
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
.moving-element { | |
will-change: transform; | |
} |
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
.final-box-title { | |
/* styles */ | |
} |
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
.box:nth-last-child(-n+1) .title { | |
/* styles */ | |
} |
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
performance.mark('expensive-start'); | |
expensive(); | |
performance.mark('expensive-end'); | |
const value = performance.measure( | |
'expensive-mark', | |
'expensive-start', | |
'expensive-end', | |
); |
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
button.onclick = () => { | |
expensive(); | |
} |
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
for(p = servinfo; p != NULL; p = p->ai_next) { | |
sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol); | |
if (sockfd == -1) { | |
perror("client: socket"); | |
continue; | |
} | |
if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) { | |
close(sockfd); | |
perror("client: connect"); |
NewerOlder