Skip to content

Instantly share code, notes, and snippets.

View dom96's full-sized avatar
🛤️

Dominik Picheta dom96

🛤️
View GitHub Profile
import os
for i in 0..6:
echo("Blah ", i)
flushFile(stdout)
os.sleep(1000)
{-# LANGUAGE OverloadedStrings #-}
import Network.SimpleIRC
import Data.Maybe
import qualified Data.ByteString.Char8 as B
onMessage :: EventFunc
onMessage s m
| msg == "|hai" = do
sendMsg s chan "hai thar!"
| B.isPrefixOf "|say" msg = do
let test
test = "hello!"
echo(test)
test = "as" # ERORROEIYYUAIDG KABOOM
import os, osproc, streams
echo(findExe"cat")
var p = startProcess(findExe"cat")
var err = p.errorStream
var outp = p.outputStream
var inp = p.inputStream
var result = ""
# All and any
template all(container, cond: expr): expr =
block:
var result = true
for it in items(container):
if not cond(it):
result = false
break
result
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<string> split(string s, char sep) {
vector<string> result;
int i, last = 0;
while (i < s.length()-1) {
if (s[i] == sep) {
import os
var
thr: TThread[char]
line = ""
lineLock: TLock
finished: bool = False
initLock(lineLock)
var
printedLines = 0
type
TSomething = object
s: string
s1: string
var s: seq[TSomething] = @[]
for i in 0..10240:
var obj: TSomething
obj.s = "blah"
obj.s1 = "asd"
s.add(obj)
import posix, os
var hints: TAddrInfo
var aiList: ptr TAddrInfo = nil
hints.ai_family = AF_INET
hints.ai_socktype = SOCK_STREAM
hints.ai_protocol = IPPROTO_TCP
if getAddrInfo("google.com", "80", addr(hints), aiList) != 0'i32: OSError()
var it = aiList
type
TEnum = enum
a, b
var foo: TEnum = TEnum(0)
echo(foo)