Skip to content

Instantly share code, notes, and snippets.

View kunigami's full-sized avatar
:octocat:
Working from home

Guilherme Kunigami kunigami

:octocat:
Working from home
View GitHub Profile
/*
* Example of embedding Github gists.
*/
#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;
if (bigvalue < a.length) {
value = a[bigvalue];
if (value & 1 > 0) {
x = a[100];
} else {
x = a[200];
}
}
// Timing attack
const t1 = performance.now();
.moving-element {
will-change: transform;
}
@kunigami
kunigami / last_child_efficient.css
Last active March 28, 2020 19:28
last_child_efficient.css
.final-box-title {
/* styles */
}
.box:nth-last-child(-n+1) .title {
/* styles */
}
performance.mark('expensive-start');
expensive();
performance.mark('expensive-end');
const value = performance.measure(
'expensive-mark',
'expensive-start',
'expensive-end',
);
button.onclick = () => {
  expensive();
}
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");
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