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
def create_app(): | |
app = Flask(__name__) | |
# setup database | |
db_api.init() | |
# set app debug mode | |
app.debug = CONF.debug | |
# request context |
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
(ns sqlcharts.core.layouts | |
(:require [clojure.string :as string] | |
[hiccup.page :refer :all] | |
[noir.validation :as vali])) | |
(defn navbar-top | |
[] | |
[:nav.navbar.navbar-default.navbar-static-top | |
[:div.container | |
[:div.navbar-header |
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
;; An Example of Emacs Script | |
;; Find all kernel processes | |
(defmacro |> (x &rest funcs) | |
`(reduce #'(lambda (z f) (apply f (list z))) (list ,@funcs) :initial-value ,x)) | |
(|> (shell-command-to-string "ps awux") | |
#'(lambda (x) (split-string x "\n")) | |
#'(lambda (x) (mapcar 'split-string x)) | |
#'(lambda (x) (remove-if-not #'(lambda (x) (string-match "^\\[" (or (car (last x)) ""))) x)) |
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/sh | |
if [ "`id -u`" != "0" ]; then | |
invoke-sudo.sh $0 $@ | |
fi | |
modprobe -r iwlmvm | |
#modprobe -r iwlwifi | |
#modprobe -r mac80211 | |
#modprobe -r cfg80211 |
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 | |
# filename : with_local.sh | |
# created at : 2015-05-04 11:28:24 | |
# author : Jianing Yang <jianingy.yang@gmail.com> | |
if [ "$#" -lt 2 ]; then | |
echo "Usage: $(basename $0) lockfile command" | |
echo "Prevent process from running when lock file exists." | |
echo |
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
for access_log in /export/logback/www*/app_m_access.log.2015-04-*.gz; do | |
( | |
csv_file="`mktemp $root/tmp/access_log-XXXXXX.csv`" | |
: > $csv_file | |
echo "processing $access_log -> $csv_file" | |
$root/scripts/parse_access_log_v2.py --source xxxxxxxx --access-log $access_log > $csv_file | |
echo "\COPY m_access_log FROM '$csv_file' WITH CSV" | connect_postgres | |
rm -f $csv_file | |
) & | |
done |
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
#ifndef CHI_SQUARE_SELECTOR_H_ | |
#define CHI_SQUARE_SELECTOR_H_ | |
#include "FeatureSelector.h" | |
namespace zdcp { | |
class ChiSquareSelector: public FeatureSelector { | |
protected: | |
#if 0 |
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 requests | |
import click | |
import sys | |
def fail(reason): | |
click.echo(click.style('[!] %s' % reason, fg='red'), err=True) | |
sys.exit(111) | |
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
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- | |
r b swpd free buff cache si so bi bo in cs us sy id wa st | |
0 0 0 6021920 272424 5282908 0 0 7 11 10 41 2 1 97 0 0 | |
0 0 0 6020864 272424 5283004 0 0 0 86 527 2188 0 1 99 0 0 | |
0 0 0 6015928 272424 5288764 0 0 0 0 480 1838 1 1 98 0 0 | |
0 0 0 6015780 272424 5288700 0 0 0 30 561 2150 1 1 99 0 0 | |
0 0 0 6015160 272424 5289108 0 0 0 550 618 1899 1 1 98 0 0 |
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
[loggers] | |
keys=root,business,business_debug | |
[handlers] | |
keys=console,business,business_debug,general | |
[formatters] | |
keys=tornado | |
[logger_root] |