Skip to content

Instantly share code, notes, and snippets.

View xmonader's full-sized avatar
🏠
Working from home

xmonader xmonader

🏠
Working from home
View GitHub Profile
from typchk import *
def validateargs(**kwargs):
c = Checker(kwargs)
def decorator(f):
def wrapper(*args, **funkwargs):
try:
if funkwargs:
res = c.check(funkwargs)
from js9 import j
def packager(flistName='js9Flist'):
"""
@param: flistName name of the flist to be created
"""
prefab = j.tools.prefab.local
print("Copying jumpscale bins")
prefab.core.file_copy('/usr/local/bin/js9', '$BINDIR')
#!/bin/bash
apt-get install build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev -y
#git clone https://github.com/facebook/rocksdb.git
cd rocksdb
make shared_lib
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:`pwd`/include
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:`pwd`
export LIBRARY_PATH=${LIBRARY_PATH}:`pwd`
import os, httpclient
import threadpool, strutils
import times
import asyncdispatch
type
# LinkCheckResult = [link: string, state:bool]
LinkCheckResult = ref object
link: string
state: bool
@xmonader
xmonader / linkschecker.nim
Created September 8, 2017 13:51
simplelinkschecker
import os, httpclient
import threadpool, strutils
import times
import asyncdispatch
type
# LinkCheckResult = [link: string, state:bool]
LinkCheckResult = ref object
link: string
state: bool
```
╭─striky@asgard ~/wspace/nidb
╰─$ tree .
.
├── LICENSE
├── nidb
├── nidb.nim
├── nidb.nimble
├── README.md
└── tests
@xmonader
xmonader / promisesexample.py
Created October 14, 2017 16:30
promisesexample.py
users = []
def registerUser(username):
global users
if username.isdigit():
raise ValueError("Invalid username: {}".format(username))
users.append(username)
return username
@xmonader
xmonader / asyncsess.py
Created October 23, 2017 21:34
asyncsess.py
import requests
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from queue import Queue
import asyncio
import aiohttp
import time
links = ["https://google.com", "https://www.amazon.com/",

Keybase proof

I hereby claim:

  • I am xmonader on github.
  • I am xmonader (https://keybase.io/xmonader) on keybase.
  • I have a public key ASBTgClO63Ak6nieyv3BaD83NHACwzj_y18Grg1vtneDSwo

To claim this, I am signing this object:

@xmonader
xmonader / urlshort.nim
Last active December 19, 2023 12:08
urlshort.nim
# nimshorturl
# Copyright xmonader
# nim url shortening service
import jester, asyncdispatch, htmlgen, json, os, strutils, strformat, db_sqlite
# hostname can be something configurable "http://ni.m:5000"
let hostname = "localhost:5000"
var theDb : DbConn
if not fileExists("/tmp/mytest.db"):
theDb = open("/tmp/mytest.db", "", "", "")
theDb.exec(sql("""create table urls (