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
""" | |
client.py - AsyncIO Server using StreamReader and StreamWriter | |
This will create 200 client connections to a server running server.py | |
It will handshake and run similar to this: | |
Server: HELLO | |
Client: WORLD |
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
#!/bin/bash | |
loopdevice=/dev/loop0 | |
loopfile=crypt.loop | |
#megabytes | |
loopsize=256 | |
#/dev/mapper/xxxxx when open | |
cryptmapper=myCrypt |
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
feedparser | |
requests |
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
""" | |
client.py - AsyncIO Server using StreamReader and StreamWriter | |
This will create 200 client connections to a server running server.py | |
It will handshake and run similar to this: | |
Server: HELLO | |
Client: WORLD |
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
#!/bin/bash | |
getversion() { | |
curl https://nodejs.org/en/ -o index.html | |
export version=$(cat index.html | grep Current | tail -n 1 | awk -F' v' '{ print $2 }' | awk -F' Current' '{ print $1 }') | |
} | |
cleandownload() { | |
rm index.html | |
rm node.tar.xz |
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
FROM centos:6 | |
RUN yum -y update && \ | |
yum -y install curl gcc gcc-c++ libaio-devel git && \ | |
yum clean all && \ | |
rm -r -f /var/cache/yum/* | |
COPY getgo.sh /opt/ | |
RUN cd /opt && chmod +x ./getgo.sh && ./getgo.sh && mkdir /usr/local/go | |
RUN groupadd -g 1000 somebody && useradd -m -u 1000 -g 1000 somebody && chown -R somebody:somebody /usr/local/go | |
ENV GOROOT=/opt/go | |
ENV GOPATH=/usr/local/go |
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
go build -ldflags "-X main.Version=`git describe --tags --long`" test.go | |
./test | |
# 4.16.5-DEV-0-g9a95002 |
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
import asyncore | |
import asynchat | |
import time | |
connections_processed = 0 | |
class AServerHandler(asynchat.async_chat): | |
# def __init__(self, sock, addr, sessions, log): |
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
import org.joda.time._ | |
val typedef = Seq("string", "datetime") | |
val data = Seq("hi","014-01-07T15:57:52.253-05:00") | |
val x: Seq[Any] = (for(i <- 0 to data.length - 1) | |
yield({ | |
if (i <= typedef.length) | |
typedef(i) match { | |
case "datetime" => new DateTime(data(i)) |
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
from datetime import datetime | |
from datetime import timedelta | |
import time | |
def getearthdate(dt_now): | |
dt_begin = datetime(dt_now.year, 1, 1) | |
dt_end = datetime(dt_now.year + 1, 1, 1) | |
delta_year_length = dt_end - dt_begin |
NewerOlder