Skip to content

Instantly share code, notes, and snippets.

View laughingman7743's full-sized avatar
🤣

laughingman7743

🤣
  • Niihama-shi
  • 09:21 (UTC +09:00)
View GitHub Profile
#!/bin/bash
sudo yum install nagios
sudo install -o nagios -g nagios -d /usr/local/nagios/plack
cd /usr/local/nagios/plack
curl -kL http://cpanmin.us/ | /usr/bin/perl - -n -lextlib Plack \
Plack::App::PHPCGI Plack::Builder::Conditionals \
Plack::Middleware::ReverseProxy CGI::Compile Starlet
//
//A Structured Logger for Fluent
//
//Copyright (C) 2011 - 2013 Muga Nishizawa
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
from operator import itemgetter
from heapq import nlargest
from itertools import repeat, ifilter
class Counter(dict):
'''Dict subclass for counting hashable objects. Sometimes called a bag
or multiset. Elements are stored as dictionary keys and their counts
are stored as dictionary values.
>>> Counter('zyzygy')
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
def retry(ExceptionToCheck, tries=5, delay=5, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlalchemy.engine import create_engine
from sqlalchemy.orm.session import sessionmaker
from model import TableName
import redshift_connection_string as setting
def main():
engine = create_engine(setting.REDSHIFT_CONNECTION_STRING)
@laughingman7743
laughingman7743 / redshift_s3_util.py
Last active March 15, 2022 15:25
redshift merge unload file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import gzip
import json
import os
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import cStringIO
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no, date=no, address=no"/>
<title></title>
<style type="text/css">
#outlook a {padding:0;}
body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fab -f fabfile_user.py -H SERVER user_add:name=USER,passwd=PASSWORD,publickey=PUBLIC_KEY,wheel=True
"""
from fabric.api import run, put, sudo, cd
"""
env.hosts = ['']
public static String generateSHA1(String str) {
String digestStr = null;
try {
MessageDigest digest = MessageDigest.getInstance("SHA");
digest.update(str.getBytes());
digestStr = new String(Hex.encodeHex(digest.digest()));
} catch (NoSuchAlgorithmException e) {
Logger.error("Unknown algorithm.", e);
}
return digestStr;
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 8;
worker_rlimit_nofile 81920;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;