Skip to content

Instantly share code, notes, and snippets.

View kaworu's full-sized avatar

Alexandre Perrin kaworu

View GitHub Profile
#include <stdint.h>
#include <stdio.h>
/* Unsigned comparisons */
/* Return 1 if condition is true, 0 otherwise */
int ct_isnonzero_u32(uint32_t x)
{
return (x|-x)>>31;
}
@kaworu
kaworu / Puzzle.cc
Last active October 19, 2018 06:58
/*
* simple led / push button based Arduino puzzle.
*/
#include <Arduino.h>
#include "Led.hh"
#include "Button.hh"
Led internal(13);
# Fail2Ban filter for openssh
#
# If you want to protect OpenSSH from being bruteforced by password
# authentication then get public key authentication working before disabling
# PasswordAuthentication in sshd_config.
#
#
# "Connection from <HOST> port \d+" requires LogLevel VERBOSE in sshd_config
#
_main:
1fa0: 55 pushl %ebp
1fa1: 89 e5 movl %esp, %ebp
1fa3: 50 pushl %eax
1fa4: b8 01 00 00 00 movl $1, %eax
1fa9: c7 45 fc 00 00 00 00 movl $0, -4(%ebp)
1fb0: 83 c4 04 addl $4, %esp
1fb3: 5d popl %ebp
1fb4: c3 retl
#include <openssl/bn.h>
int
main(void)
{
BIGNUM *z, *mz;
z = BN_new();
if (BN_zero(z) == 0)
return (1);
Welcome to Swift version 4.0.2 (swift-4.0.2-RELEASE). Type :help for assistance.
1> import Foundation
/home/alex/.local/swift-4.0.2-RELEASE-ubuntu16.04/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:10: note: while building module 'SwiftGlibc' imported from /home/alex/.local/swift-4.0.2-RELEASE-ubuntu16.04/usr/lib/swift/CoreFoundation/CoreFoundation.h:25:
#include <sys/types.h>
^
<module-includes>:3:10: note: in file included from <module-includes>:3:
#include "///usr/include/utmp.h"
^
@kaworu
kaworu / t.c
Created December 12, 2017 08:53
#include <stdio.h>
int
main(int argc, char **argv)
{
unsigned char uc = 1;
signed char sc = -1;
unsigned int ui = 1;
signed int si = -1;
unsigned long ul = 1;
BEGIN {
xs["foo"] = 1;
xs["bar"] = 1;
f();
}
function f() {
for (i in xs) {
for (j in xs) {
BEGIN {
xs["foo"] = 1;
xs["bar"] = 1;
xs["oni"] = 1;
f();
}
function f() {
for (i in xs) {
@kaworu
kaworu / t.s
Created September 19, 2017 09:36
console.log((s=>[...s].reduce((m,x)=>m+x.charCodeAt(),0)%42?"N":"Y")(process.argv[2]))