Skip to content

Instantly share code, notes, and snippets.

View shatil's full-sized avatar
💭
Not lurking

Shatil Rafiullah shatil

💭
Not lurking
View GitHub Profile
@shatil
shatil / main.go
Last active July 23, 2019 07:29
time.Tick with burst capability
package main
import "time"
// TickBurst creates a time.Tick()-like throttle with an initial burst.
//
// The created channel is replenished using time.Tick() every given interval,
// making it useful to limit concurrency. You can have an initial burst of 10
// requests, for example, and permit one additional request every millisecond.
//
@shatil
shatil / dstat-while-running-badblocks.txt
Created July 6, 2017 20:44
SM2280S3G2/120G write vs. read performance running badblocks -w (0xaa)
--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system--
usr sys idl wai stl| read writ| recv send| in out | int csw
2 3 73 23 0| 0 195M| 986B 0 | 0 0 |3223 31k
2 2 73 23 0| 0 194M|1052B 0 | 0 0 |3392 29k
2 2 73 23 0| 0 196M|1412B 0 | 0 0 |3314 33k
2 2 73 23 0| 0 195M|1056B 0 | 0 0 |3287 31k
1 3 73 23 0| 0 195M|1184B 0 | 0 0 |3232 34k
1 3 73 23 0| 0 191M|1692B 0 | 0 0 |3235 33k
1 3 72 23 0| 0 195M|2706B 0 | 0 0 |3415 34k
2 2 73 23 0| 0 193M|2158B 0 | 0 0 |3276 34k
@shatil
shatil / docker-compose.yml
Created June 25, 2017 07:14
python3 make.py generated docker-compose.yml
services:
8u121-jre:
command:
- /entrypoint.sh
healthcheck:
test: curl --fail --insecure https://localhost:9443/
image: openjdk:8u121-jre
ports:
- '9000'
- '9443'
@shatil
shatil / make.py
Created June 25, 2017 07:07
Generate docker-compose.yml `services` entries dynamically with Python
#!/usr/bin/env python3
from __future__ import print_function
try:
from ruamel import yaml
except ImportError:
import yaml
# Map a Docker Compose "service" name to its image.
@shatil
shatil / docker-compose.yml
Last active June 25, 2017 07:05
Docker Compose to build a single service w/o Dockerfile
services:
8u121-jre-alpine:
command:
- /entrypoint.sh
ports:
- '9000:9000'
- '9443:9443'
image: openjdk:8u121-jre-alpine
volumes:
- ./entrypoint.sh:/entrypoint.sh:ro
@shatil
shatil / Dockerfile
Last active June 24, 2017 23:45
Docker Compose a single service w/ image (Dockerfile included)
FROM openjdk:8u121-jre-alpine
COPY svc /svc
EXPOSE 9000 9443
CMD ["/svc/bin/start", "-Dhttps.port=9443", "-Dplay.crypto.secret=secret"]
@shatil
shatil / manifest.json
Created December 6, 2016 23:55
manifest.json packed into chef-backup-2016-12-05-20-19-43.tgz by "chef-server-ctl backup"
{
"strategy": "tar",
"backup_time": "2016-12-05-20-19-43",
"topology": "standalone",
"ha": {
},
"services": {
"rabbitmq": {
"data_dir": "/var/opt/opscode/rabbitmq/db"
},
@shatil
shatil / punnel.py
Created July 27, 2016 17:37
Python OpenSSL libraries' private key signing vs. OpenSSL's rsautl
#!/usr/bin/env python
from __future__ import print_function
import base64
import sys
PEM = ("""-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAgK1Q6Ydi8UUheJLvnTYJE65NOZtAtjDdDSxS+6b4x9EakjIylljSzs5uLEJn