Skip to content

Instantly share code, notes, and snippets.

View dom96's full-sized avatar
🛤️

Dominik Picheta dom96

🛤️
View GitHub Profile
import asyncdispatch, httpclient, os, strutils
# ~/nimbb/nim/bin/nim c --threadAnalysis:off -d:ssl -r tcrawl3.nim 10 300 500
var numRunning = 0
var good = 0
var bad = 0
# not used....
var concurrency = 3
import asynchttpserver, httpclient, parseurl, asyncdispatch, strtabs, strutils
var server = newAsyncHttpServer()
proc onRequest(req: TRequest) {.async.} =
var client = newAsyncHttpClient()
var htmlResp = ""
try:
let reqResp = await client.get(req.url.path)
import strutils, os
proc simplifyPath(path: string): string =
var segments: seq[string] = @[]
var i = 0
var curDir = ""
while true:
case path[i]
of dirSep, altSep:
import macros, strutils
type
TokenKind = enum
FInt, FString, Text
Token = object
case kind: TokenKind
of FInt, FString: nil
of Text: c: String
import asyncnet, asyncdispatch
var clients: seq[PAsyncSocket] = @[]
proc processClient(client: PAsyncSocket) {.async.} =
while true:
let line = await client.recvLine()
for c in clients:
await c.send(line & "\c\L")
import
asyncdispatch, asyncnet, htmlparser, xmltree, httpclient, strutils,
strtabs, streams, uri, sets
var visited = initSet[string]()
proc crawl(url: string, client: PAsyncHttpClient = newAsyncHttpClient()) {.async.} =
if url in visited: return # Already visited this URL.
echo("Crawling ", url)
visited.incl(url)
<carols> =====BEGIN GSOC 2014 ORG REJECTION FEEDBACK MEETING====
<carols> hi everyone, thanks for coming
<carols> this year we got 371 (well, technically 372) applications from organizations for the program.
<carols> we accepted 190 organizations in total
<carols> but unfortunately, we always have less space for orgs than we have applications.
<carols> this year we emphasized, as we have in the past, accepting organizations that have never participated before and/or were small communities
* bakercp is now known as openFrameworks_b
<carols> we again saw a huge amount of applications from folks in the bioinformatics, life sciences, and biology fields
* 64MAAD0I7 is now known as kshitij
<carols> but we also got some great new applications from fields we've never had participate before
import macros
macro `=>`(p, b: expr): expr {.immediate.} =
echo treeRepr(p)
#echo(treeRepr(b))
var params: seq[PNimrodNode] = @[newIdentNode("auto")]
case p.kind
of nnkPar:
for c in children(p):
[Package]
name = "kwin-tiling"
version = "0.1.0"
author = "Simon Hafner"
description = "Tiling for the KWin window manager."
license = "GPLv2"
bin = "tiling"
backend = "js"
# Compile with nimrod c -d:release --threads:on PN.nim
import os, strutils, unsigned
const
TileDim = 50
Miw = 2
MaxWid = 8
NumLevs = 800