Skip to content

Instantly share code, notes, and snippets.

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

Naoya Nakazawa n0ts

🏠
Working from home
  • Freelancer
  • Tokyo, Japan
  • X @n0ts
View GitHub Profile
@n0ts
n0ts / test-dd-threadstats.py
Created September 13, 2016 03:19
Datadog Agent ThreadStats sample code
# test for Threadstat - a tool for collecting metrics in high performance applications
# http://datadogpy.readthedocs.io/en/latest/#datadog-threadstats-module
import random, time, os, yaml
# Configure the module according to your needs
from datadog import initialize
from datadog.util.config import get_config
# initialize(api_key=None, app_key=None, host_name=None, api_host=None, statsd_host=None, statsd_port=None, statsd_use_default_route=False, **kwargs)
config = get_config()
@n0ts
n0ts / gist:eb01f31ce1386d18bd2c84d5d4ef43ac
Last active August 4, 2016 04:56
HTML5 details test
<details>
require('does.not.exist')
Error: Cannot find module 'does.not.exist'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at repl:1:1
at REPLServer.defaultEval (repl.js:164:27)
at bound (domain.js:250:14)
traps: python[591] general protection ip:7f5fa2051350 sp:7f5f7b7f9c70 error:0 in libcrypto.so.1.0.0[7f5fa1f90000+19c000]
@n0ts
n0ts / pyenv_awscli.sh
Created August 23, 2013 10:02
zsh aws completion for pyenv
# pyenv
if [ -f "$HOME/.pyenv/version" ]; then
# awscli
if [ -f "$HOME/.pyenv/versions/$(cat $HOME/.pyenv/version)/bin/aws_zsh_completer.sh" ]; then
source $HOME/.pyenv/versions/$(cat $HOME/.pyenv/version)/bin/aws_zsh_completer.sh
fi
fi
ERROR (ddagent.py:274): Response: HTTPResponse(_body=None,buffer=None,code=599,effective_url='https://5-8-0-app.agent.datadoghq.com/intake/?api_key=*****************************',error=HTTPError('HTTP 599: Timeout',),headers={},reason='Unknown',request=<tornado.httpclient.HTTPRequest object at 0x7fae74d94d50>,request_time=20.000539779663086,time_info={})
@n0ts
n0ts / gist:3b1611eb54807833cca28fe920f2c3f8
Last active May 25, 2016 05:53
nginx-full mruby compile error at 10.11.5
$ brew install nginx-full --devel --with-passenger --with-addition --with-auth-req --with-degredation --with-flv --with-geoip --with-google-perftools --with-gunzip --with-gzip-static --with-http2 --with-image-filter --with-mail --with-mp4 --with-pcre-jit --with-perl=/usr/local/homebrew/perl --with-random-index --with-realip --with-secure-link --with-status --with-stream --with-sub --with-webdav --with-xslt --with-mruby-module --with-lua
...
build: [exec] git clone git://github.com/redis/hiredis.git
Cloning into 'hiredis'...
build: [exec] make
make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
clang -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings -std=c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
net.c:139:37: error: use of undeclared identifier 'TCP_KEEPALIVE'
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &val, sizeof(val)) < 0) {
@n0ts
n0ts / disable_service_centos6.sh
Last active January 4, 2016 13:58
Disable Service for CentOS 6 on VM
while read SERVICE
do
service $SERVICE stop
chkconfig $SERVICE off
done << EOL
ip6tables
iptables
netfs
EOL
@n0ts
n0ts / disable_service_centos5.sh
Last active January 4, 2016 10:59
Disable Service for CentOS 5 on VM
while read SERVICE
do
service $SERVICE stop
chkconfig $SERVICE off
done << EOL
acpid
auditd
autofs
bluetooth
firstboot
@n0ts
n0ts / setterm
Last active January 4, 2016 10:59
/etc/init.d/setterm
#!/bin/sh
### BEGIN INIT INFO
# Provides: setterm
# Required-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: disable console blanking
# Description: ref.
#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>
main() {
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server = "localhost";