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
/etc/localtime: | |
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime | |
/etc/rc.conf: | |
inetd=NO | |
postfix=NO | |
named=YES | |
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
import qualified Data.HashMap.Strict as M | |
import qualified Data.ByteString.Char8 as B | |
import Data.List (sortOn) | |
import Data.List.Split (chunksOf) | |
import Control.Parallel.Strategies (parMap, rdeepseq) | |
main = do | |
words <- B.words <$> B.getContents | |
let result = sortOn snd $ M.toList $ foldl (M.unionWith (+)) M.empty $ parMap rdeepseq (foldl (\acc x -> M.insertWith (+) x (1 :: Integer) acc) M.empty) (chunksOf 50000 words) | |
B.putStr . B.concat $ result >>= (\(a,b) -> [B.pack $ show b, B.singleton '\t', a, B.singleton '\n']) |
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
import Data.Complex | |
import Data.List | |
import Control.Parallel.Strategies | |
mandelbrot c = c : [z^2 + c | z <- mandelbrot c] | |
color (a,b,c,d) x y | |
| len < a = ' ' | |
| len < b = '.' | |
| len < c = ':' |
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
triangles = [(a,b,c) | a<-[1..], b<-[1..a-1], c<-[a..a+b], a^2+b^2==c^2] | |
main = putStr $ unlines $ map show triangles |
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
pub inline fn out(port: u16, value: var) void { | |
const TypeId = @import("builtin").TypeId; | |
const maxInt = @import("std").math.maxInt; | |
const value_ = switch (@typeId(@typeOf(value))) { | |
TypeId.ComptimeInt => switch (value) { | |
0...maxInt(u8) => @intCast(u8, value), | |
maxInt(u8) + 1...maxInt(u16) => @intCast(u16, value), | |
maxInt(u16) + 1...maxInt(u32) => @intCast(u32, value), | |
else => @compileError("port out of range"), |
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
s/\x1b\[0m/\x0f/g | |
s/\x1b\[1m/\x02/g | |
s/\x1b\[30m/\x031/g | |
s/\x1b\[31m/\x035/g | |
s/\x1b\[32m/\x033/g | |
s/\x1b\[33m/\x037/g | |
s/\x1b\[34m/\x032/g | |
s/\x1b\[35m/\x036/g | |
s/\x1b\[36m/\x0310/g | |
s/\x1b\[37m/\x0315/g |
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
Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" | |
, additionalFonts = [] | |
, borderColor = "black" | |
, border = TopB | |
, bgColor = "black" | |
, fgColor = "grey" | |
, alpha = 255 | |
, position = Top | |
, textOffset = -1 | |
, iconOffset = -1 |
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 <linux/perf_event.h> | |
#include <linux/hw_breakpoint.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <asm/unistd.h> | |
#include <stdio.h> | |
int main() | |
{ | |
if (geteuid() != 0) { |
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 <sys/time.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#define THRESHOLD 1000 | |
int main() | |
{ | |
struct timeval a; | |
struct timeval b; |
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
const std = @import("std"); | |
fn Add(comptime A: type, comptime B: type) type { | |
if (A == type) { | |
return B; | |
} else { | |
return Add(@typeInfo(A).Pointer.child, *B); | |
} | |
} |