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"); |
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 addrinfo { | |
int ai_flags; // AI_PASSIVE, AI_CANONNAME, etc. | |
int ai_family; // AF_INET, AF_INET6, AF_UNSPEC | |
int ai_socktype; // SOCK_STREAM, SOCK_DGRAM | |
int ai_protocol; // use 0 for "any" | |
size_t ai_addrlen; // size of ai_addr in bytes | |
struct sockaddr *ai_addr; // struct sockaddr_in or _in6 | |
char *ai_canonname; // full canonical hostname | |
struct addrinfo *ai_next; // linked list, next node |
NewerOlder