Skip to content

Instantly share code, notes, and snippets.

View pjvds's full-sized avatar
:octocat:
‏‏‎

Pieter Joost van de Sande pjvds

:octocat:
‏‏‎
View GitHub Profile
4b458af3-2e58-4e73-a0c7-79c82622b64f
func Format(entry tidy.Entry) ([]byte, error) {
buffer := make([]byte, 0)
term := terminal.TerminalWriter{buffer}
color := colors[entry.Level]
term.Color(color).Print(entry.Timestamp.Format("15:04:05"))
term.Print(entry.Level.FixedString())
term.Print(" [").Print(entry.Module).Print("] ").Reset()
term.Print(" ").Print(entry.Message)
Mar 04 16:51:08 deis03 systemd[1]: Starting deis-store-monitor...
Mar 04 16:51:09 deis03 systemd[1]: Started deis-store-monitor.
Mar 04 16:51:09 deis03 sh[24917]: store-monitor: Ceph hasn't yet been deployed. Trying to deploy...
Mar 04 16:51:09 deis03 sh[24917]: store-monitor: obtained the lock to proceed with setting up.
Mar 04 16:51:11 deis03 sh[24917]: creating /etc/ceph/ceph.client.admin.keyring
Mar 04 16:51:11 deis03 sh[24917]: creating /etc/ceph/ceph.mon.keyring
Mar 04 16:51:11 deis03 sh[24917]: monmaptool: monmap file /etc/ceph/monmap
Mar 04 16:51:11 deis03 sh[24917]: monmaptool: /etc/ceph/monmap exists, --clobber to overwrite
Mar 04 16:51:11 deis03 systemd[1]: deis-store-monitor.service: main process exited, code=exited, status=255/n/a
Mar 04 16:51:11 deis03 systemd[1]: Unit deis-store-monitor.service entered failed state.
# adds epel and install znc
yum localinstall -y http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum install -y znc
# configure firewalld
echo '<?xml version="1.0" encoding="utf-8"?> <service> <short>znc</short> <description>znc irc bouncer</description> <port protocol="udp" port="6666"/></service>' > /etc/firewalld/services/znc.xml
restorecon /etc/firewalld/services/znc.xml
chmod 640 /etc/firewalld/services/znc.xml
firewall-cmd --reload
firewall-cmd --permanent --add-service=znc
@pjvds
pjvds / mongo-auto-increment-onliner.js
Last active August 29, 2015 14:14
in-line auto increment in mongodb
db.docs.insert({
_id: db.counter.findAndModify({
query: { _id: 'docs' },
update: { $inc: { seq: 1 } },
new: true,
upsert: true
}).seq
})
using System;
using System.IO;
using System.Threading;
using System.Diagnostics;
namespace Born2Code.Net
{
/// <summary>
/// Class for streaming data with throttling support.
/// </summary>
+-+ +-+ +-+ +-+ +-+
|1| |2| |3| |4| |5|
+-+ +-+ +-+ +-+ +-+
^ ^ ^
SUB A SUB B WRITER
I0129 17:15:44.549211 74897 main.go:50] all clients done 2423150 msg in 5.364528279s, 451698.61616456957msg/s
I0129 17:15:49.549476 74897 main.go:50] all clients done 983900 msg in 5.000153634s, 196773.9537660774msg/s
I0129 17:15:54.549672 74897 main.go:50] all clients done 598550 msg in 5.00011583s, 119707.2268623825msg/s
I0129 17:15:59.550084 74897 main.go:50] all clients done 624350 msg in 5.000308165s, 124862.30436159529msg/s
I0129 17:16:04.550404 74897 main.go:50] all clients done 355000 msg in 5.000188944s, 70997.3170965837msg/s
I0129 17:16:09.550666 74897 main.go:50] all clients done 737150 msg in 5.000199473s, 147424.11857375913msg/s
I0129 17:16:14.551997 74897 main.go:50] all clients done 732900 msg in 5.00017349s, 146574.91414362905msg/s
I0129 17:16:19.553304 74897 main.go:50] all clients done 307550 msg in 5.000122972s, 61508.48723566153msg/s
I0129 17:16:24.621835 74897 main.go:50] all clients done 50450 msg in 5.055453359s, 9979.322608166505msg/s
I0129 17:16:29.704699 74897 mai
for i in $(seq 1 5); do echo "$i: " ; go run main.go -duration 1m ; echo "\n" ; sleep 15; done
1:
54526336 messages written in 1m0.743716405s, 897646msg/s, 175.321mb/s
/tmp/seqcask_bench_838230236/db.data: 28610mb
2:
54309248 messages written in 1m0.051493969s, 904378msg/s, 176.636mb/s
/tmp/seqcask_bench_065558123/db.data: 28610mb
for i in $(seq 1 5); do echo "$i: " ; go run main.go -duration 1m ; echo "\n" ; sleep 15; done
1:
54053184 messages written in 1m0.14815918s, 898667msg/s, 175.521mb/s
/tmp/seqcask_bench_104758691/db.data: 28610mb
2:
54177408 messages written in 1m0.033588751s, 902452msg/s, 176.260mb/s
/tmp/seqcask_bench_734667518/db.data: 28610mb