Skip to content

Instantly share code, notes, and snippets.

View antekone's full-sized avatar
🪤
Focusing

Grzegorz Antoniak antekone

🪤
Focusing
View GitHub Profile
#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];
#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);
#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,
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
#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");
#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
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
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
(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 January 16, 2015 13:28
prime generation by trial division testing
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