This file contains hidden or 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 <pthread.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define NORETURN(x) ((void)(x)) | |
| struct llist { | |
| struct llist *next; | |
| struct llist *prev; | |
| }; |
This file contains hidden or 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 <pthread.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #ifndef NORETURN | |
| #define NORETURN(x) ((void)(x)) | |
| #endif | |
| #ifndef UNUSED | |
| #define UNUSED NORETURN |
This file contains hidden or 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
| use std::collections::HashMap; | |
| use std::fmt; | |
| #[derive(Debug, Clone, PartialEq)] | |
| pub enum Value { | |
| Number(f64), | |
| String(String), | |
| Symbol(String), | |
| List(Vec<Value>), | |
| Function(fn(&[Value]) -> Result<Value, String>), |
This file contains hidden or 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
| require 'socket' | |
| require 'thread' | |
| socket = Socket.new Socket::AF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP | |
| socket.setsockopt :SOCKET, :REUSEADDR, 1 | |
| socket.bind Addrinfo.tcp('0.0.0.0', 31338) | |
| socket.listen 0 | |
| puts "Listen on 0.0.0.0 port 31338" |
This file contains hidden or 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
| .section .text | |
| .globl le32_to_be32 | |
| .type le32_to_be32, @function | |
| le32_to_be32: | |
| pushl %ebp | |
| movl %esp, %ebp | |
| subl $0x14, %esp | |
| pushl %ebx | |
| pushl %ecx | |
| pushl %edx |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| "unsafe" | |
| ) | |
| // IEEE-754 floating-point representation. | |
| func ieee754BinRep(x float64) uint64 { |
This file contains hidden or 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
| # this is an implementation of creating mad and stupid yet concurrent | |
| # web server with only 65535 iteration before calling fork() syscall. | |
| # | |
| # fyi: this is pwn.college web server challenge | |
| # | |
| # Paulus Gandung Prakosa <[email protected]> | |
| # | |
| .section .rodata | |
| .resp: |
This file contains hidden or 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
| namespace foobar | |
| module [ | |
| ohm.encoding.json | |
| ohm.util.io | |
| ohm.lang.types.String | |
| org.project.foo | |
| org.project.bar | |
| ohm.native.syscall | |
| ] |
This file contains hidden or 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
| - Don't ask questions | |
| - Don't take an interest in people outside of work | |
| - Erase every trace | |
| - Know when it's time to get out |
This file contains hidden or 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
| # Full adder implementation | |
| # Paulus Gandung Prakosa <[email protected]> | |
| # ref: https://en.wikipedia.org/wiki/Adder_(electronics)#Full_adder | |
| import math | |
| import sys | |
| def bit_count(x): | |
| return x if x == 0 else math.floor(math.log2(x)) + 1 |
NewerOlder