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
grep "25/Jan" access_log | cut -d[ -f2 | cut -d] -f1 | awk -F: '{print $2":00"}' | sort -n | uniq -c |
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
csplit -k some_file.sql -f some_file_prefix -b %02u.sql 500 {10000} | |
500 is number of lines | |
{10000} is how many times to repeat an action |
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
$ grep "GET /foo/bar.html" access_log | awk '{print $4}' | cut -d: -f1 | uniq -c | |
281 [27/Jan/2013 | |
288 [28/Jan/2013 | |
40 [29/Jan/2013 | |
38 [30/Jan/2013 | |
20 [31/Jan/2013 | |
$ grep "POST /foo/doBar.html" access_log | awk '{print $4}' | cut -d: -f1 | uniq -c | |
160 [27/Jan/2013 | |
150 [28/Jan/2013 |
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
[root][henry][~] | |
$ cd ~/.ssh | |
[root][henry][~/.ssh] | |
$ ll -tr config | |
-rw-r--r-- 1 root root 143 2012-10-04 13:06 config | |
# note the permissions -> user:group [644] | |
[root][henry][~/.ssh] | |
$ cat config |
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
export PS1="[\[\033[1;31m\]\u\[\033[m\]][\[\033[32m\]\H\[\033[m\]][\[\033[36m\]\w\[\033[m\]]\n\$ " |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>MTA Fare Calculator</title> | |
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>MTA Fare Calculator</title> | |
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="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
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7' ) | |
import groovyx.net.http.ContentType | |
import groovyx.net.http.RESTClient | |
def apiUrl = 'http://localhost:8888' | |
def api = new RESTClient(apiUrl, ContentType.JSON) | |
api.headers = ['auth-key': '11', 'Accept': 'application/json; q=0.9,*/*; q=0.8'] | |
def id = 20784 |
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 use with your own local copy of nu validator @ http://about.validator.nu/#src | |
@GrabConfig(systemClassLoader=true) | |
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7') | |
import groovyx.net.http.HTTPBuilder | |
def client = new HTTPBuilder('http://localhost:8888') | |
def boundary = '----hyunlabs_boundary' |
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
class BaseUrlHandler implements Handler { | |
void handle(Context context) throws Exception { | |
context.with { | |
def headers = request.headers | |
def scheme = headers.contains('X-Forwarded-Proto') ? headers.get('X-Forwarded-Proto') : 'http' | |
def domain = headers.get('Host') ?: headers.get('host') | |
def baseUrl = "${scheme}://${domain}" as String |
OlderNewer