This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Text.Read ( reads ) | |
import System.IO ( FilePath | |
, readFile | |
) | |
import System.Directory ( doesFileExist ) | |
import Control.Monad ( forever ) | |
import Control.Concurrent ( MVar |
This file contains 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
def async_read_cache(key, opts={}, &generate) | |
fetcher = lambda do | |
Thread.new do | |
res = { status: :success, data: generate.call } | |
Rails.cache.set(key, opts, res) | |
end | |
{status: :pending} | |
end | |
cached_result = Rails.cache.fetch(key, opts, fetcher) | |
if cached_result[:status] == :pending |
This file contains 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 <iostream> | |
#include <iomanip> | |
#include <sstream> | |
#include <gmpxx.h> | |
// Using the Babylonian method here, since it's generally good enough | |
// (with quadratic convergence in the worst case) | |
// \begin{align*} | |
// x_0 &= \text{some initial approximation} \\ |
This file contains 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
#!/usr/bin/env python3 | |
# https://www.redblobgames.com/grids/hexagons is a nice reference | |
import math | |
import random | |
import collections | |
# importing gtk | |
import gi |
This file contains 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
#version 330 core | |
in vec2 fragmentUV; | |
uniform sampler2D tex; | |
out vec3 color; | |
void main(){ | |
color = texture(tex, fragmentUV).rgb; |
This file contains 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
{-# LANGUAGE OverloadedStrings, TupleSections #-} | |
module Main where | |
import System.Environment (getArgs) | |
import qualified Data.Text as T | |
import qualified Data.Text.Read as TR | |
import qualified Data.Text.IO as TIO | |
import qualified Data.Map.Strict as Map |
This file contains 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
{-# LANGUAGE OverloadedStrings, FlexibleContexts #-} | |
module Main where | |
import System.Environment (getArgs, getProgName) | |
import qualified Data.ByteString.Lazy.Char8 as BS | |
import Data.Maybe (fromJust) | |
import qualified Data.Set as Set |
This file contains 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
-- make them install haskell-platform | |
-- first show on ghci | |
-- numbers, arithmetic, comparison | |
-- booleans, logical operators | |
-- string literals, finding a type of sth | |
-- lists of integers | |
-- head and tail functions | |
-- succ function | |
-- map succ over some list |
This file contains 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
-- make them install haskell-platform | |
-- first show on ghci | |
-- numbers, arithmetic, comparison | |
-- booleans, logical operators | |
-- string literals, finding a type of sth | |
-- lists of integers | |
-- head and tail functions | |
-- succ function | |
-- map succ over some list |
This file contains 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
CFLAGS := -I/usr/local/include -Iinclude/ -std=gnu11 -g -O0 -Wall -Werror -Wpedantic | |
LDFLAGS := -L/usr/local/lib -luv -lck | |
SRCS := $(wildcard src/*.c) | |
OBJS := $(addprefix dest/, $(notdir $(SRCS:%.c=%.o))) | |
DEPS := $(addprefix dest/, $(notdir $(SRCS:%.c=%.d))) | |
all: dest/server | |
.PHONY: clean |