Skip to content

Instantly share code, notes, and snippets.

@apit
apit / apm.log
Created February 16, 2022 10:28
app_1 | 2022-02-16 17:24:09.928126+07:00 [PID: 1] [TID: 1] [DEBUG] [Log] [log.c:748] [logConfigChangeInLevel] Log level for sink Stderr changed from CRITICAL to TRACE.
app_1 | 2022-02-16 17:24:09.928162+07:00 [PID: 1] [TID: 1] [DEBUG] [Log] [log.c:748] [logConfigChangeInLevel] Log level for sink Syslog changed from INFO to TRACE.
app_1 | 2022-02-16 17:24:09.928185+07:00 [PID: 1] [TID: 1] [DEBUG] [Log] [log.c:748] [logConfigChangeInLevel] Log level for sink File changed from INFO to TRACE.
app_1 | 2022-02-16 17:24:09.928209+07:00 [PID: 1] [TID: 1] [DEBUG] [Log] [log.c:748] [logConfigChangeInLevel] Max enabled log level changed from INFO to TRACE.
app_1 | 2022-02-16 17:24:09.928231+07:00 [PID: 1] [TID: 1] [DEBUG] [Log] [log.c:802] [logConfigChange] Path for file logging sink did not change. Its value is still NULL.
app_1 | 2022-02-16 17:24:09.928257+07:00 [PID: 1] [TID: 1] [DEBUG] [Lifecycle] [lifecycle.c:71] [logSupportabilityInfo] Version of agent C part: 1.4.1
app_1 | 2
@apit
apit / post-receive
Last active May 31, 2018 03:18
pull the latest code on dev web server
#!/bin/bash
# On Windows, git-bash must be installed
# must be the same server with repo
$DOCROOT="/e/APPS_KELEMBAGAAN/umum/sma/.git"
while read oldrev newrev ref
do
echo "git pull-ing on /e/APPS_KELEMBAGAAN/umum/sma"
#!/bin/bash
# PHP CodeSniffer pre-receive hook for git
#exit 0 #if you want to skip all validation
PHPCS_BIN="/c/apps/PHP/composer/phpcs"
PHPCS_IGNORE=*/Migrations/*,*/vendor/*
PHPCS_CODING_STANDARD="PSR2"
TMP_DIR=$(mktemp -d phpcs-pre-receive-hook.XXXXXXXX)
<?php
public function routeClass()
{
$routeArray = Str::parseCallback(Route::currentRouteAction(), null);
if (last($routeArray) != null) {
// Remove 'controller' from the controller name.
$controller = str_replace('Controller', '', class_basename(head($routeArray)));
@apit
apit / Default (Linux).sublime-keymap
Created September 12, 2011 03:34 — forked from coldnebo/Default (Linux).sublime-keymap
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@apit
apit / get-ted.py
Created September 6, 2011 05:28
TED video/subtitle/comments downloader
#! /usr/bin/python -u
"""
@author apit - http://fizdoonk.multiply.com/
@require python-lxml, python-simplejson
"""
import os, sys, re, codecs
import simplejson
import urllib2
@apit
apit / install_apk
Created January 4, 2011 07:54
build and install titanium's mobile project into connected device
#!/bin/bash
# run this from project's root
# adb must be in PATH
# http://builds.appcelerator.com.s3.amazonaws.com/index.html
SDK_VERSION='1.6.0'
# key signing, not used for now
KEY="mykey"
"""
Usage:
import debug
class BaseHandler(tornado.web.RequestHandler):
def get_error_html(self, status_code, **kwargs):
if self.application.settings['debug']:
return debug.display(self, kwargs['exception'])
#! /usr/bin/python -u
# @author apit - http://fizdoonk.multiply.com/
# output: http://fizdoonk.blogspot.com/2009/12/not-oldest-one.html
import re
from lxml.html import parse
from GChartWrapper import *
def display_pie(stat, title=None):