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
{-# 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)
/*
* 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");