Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Grzegorz Antoniak antekone

🎯
Focusing
View GitHub Profile
View rar5_test_poc.c
#include <libarchive/archive.h>
#include <libarchive/archive_entry.h>
#include <stdio.h>
int main(int argc, char** argv) {
struct archive* a = archive_read_new();
struct archive_entry* e;
int ret, i;
char buf[1024];
View xar-bug.c
#include <stdio.h>
#include <archive.h>
#include <archive_entry.h>
#define LOG(...) { printf(__VA_ARGS__); puts(""); }
int main() {
const char* file_name = "test.pkg";
struct archive* a = archive_read_new();
archive_read_support_filter_gzip(a);
View apfs_check.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
unsigned char block2[4096] = {
0xc1, 0x6f, 0x9c, 0xaa, 0xb5, 0x0d, 0xb2, 0x20,
0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
View find_highest_oom_score.rb
highest = 0
highest_score = 0
Dir["/proc/*"].each() do |pidstr|
next if not pidstr =~ /^\/proc\/([0-9]+)$/
pid = $1.to_i
score = IO.readlines("/proc/#{pid}/oom_score").join().to_i
if score > highest_score
View memtest.c
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int global_var = 0;
int main() {
int fd = open("/proc/self/mem", O_RDWR);
if(!fd) {
printf("can't open /proc/self/mem as O_RDWR\n");
View bswaptest.h
#pragma once
#define NAMESPACE_ENDIANCONVERSION_BEGIN namespace EndianConversion {
#define NAMESPACE_ENDIANCONVERSION_END }
#include <stdint.h>
// __BYTE_ORDER__ is a gcc macro
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define __LESWAP(n, x) x
View stream.hs
import qualified Data.ByteString.Lazy as BL
import Data.Binary.Get
import Data.Word
import Data.Bits
import Data.Char
readArray :: Get [Word8]
readArray = do
empty <- isEmpty
if empty
View ioread.hs
import qualified Data.ByteString.Lazy as BL
import Data.Binary.Get
import Data.Word
readArray :: Get [Word8]
readArray = do
empty <- isEmpty
if empty
then return []
else do
View gist:1ef796d1f0f3121c6063
(ns s512.core
(:require [clojure.java.io :as io])
(:gen-class))
(set! *warn-on-reflection* true)
(defn data-file []
(io/file "out.bin"))
(defn data-stream []
@antekone
antekone / gist:f80dd4583c6672439124
Created Jan 16, 2015
prime generation by trial division testing
View gist:f80dd4583c6672439124
checkd :: [Int] -> Int -> Int
checkd [] n = n
checkd (prime:primes) n =
if (elem n primes || n `mod` prime == 0) then
prime
else
checkd primes n
preplist :: [Int] -> Int -> [Int]
preplist curlist n = filter (\ x -> x < (n `div` 2 + 1)) curlist
You can’t perform that action at this time.