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
public function get_langname_byBrowser() | |
{ | |
$this->CI = & get_instance(); | |
// inicializamos, por si no detecta ninguna el navegador | |
$name = ""; | |
//prepare user language array | |
$languages = array(); | |
$languages[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
find ./ -type f -size -5 | awk 'BEGIN {FS=".html"}{print $1}' | awk 'BEGIN {FS="./"}{print $2","}' > urls.csv |
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 | |
LOGFILE="ping_mysql.log" | |
DBUSER="dummyuser" | |
DBPASS="dummypass" | |
DBHOST="localhost" | |
while : | |
do | |
mysqladmin ping -u $DBUSER -p $DBPASS -h $DBHOST >> $LOGFILE | |
mysqladmin status -u $DBUSER -p $DBPASS -h $DBHOST >> $LOGFILE |
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
SELECT TABLE_NAME, COLUMN_NAME | |
FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE column_name LIKE '%column_name%'; |
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
''' | |
this snippet is used to load a web2py environment | |
you must install web2py (so gluon.*) from pyeggs : "pip install web2py" | |
it will read your db.py models from the same directory | |
''' | |
# web2py env | |
from gluon.shell import exec_environment | |
import MySQLdb | |
from gluon import DAL, Field | |
from gluon.template import render |
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 | |
from couchdb.client import Server | |
# connection | |
server = Server('http://localhost:5984') | |
server.resource.credentials('username','password') | |
# create a database | |
db = server.create('mycouchdb') |
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
# CouchDB cheatsheet via REST API | |
HOST="http://username:password@localhost:5984" | |
# couchdb | |
curl -X GET $HOST | |
# check available databases | |
curl -X GET $HOST/_all_dbs |
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
# nginx configuration | |
# any access to http://myurl.com/new/blablabla has to load http://myurl.com/old/blablabla without change url | |
# this is redirecting and changing the url | |
location ^~ /new/ { | |
rewrite ^/new/(.*)$ /old/$1 permanent; | |
} | |
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
# input: | |
# 2012/02/10 09:32:36 [error] 17798#0: *30890 open() "/var/www/media/icon.png" failed (2: No such file or directory), | |
# client: 10.10.100.100, server: dev.myserver.com, request: "GET /media/icon.png HTTP/1.1", host: "dev.myserver.com", | |
# referrer: "http://dev.myserver.com/index" | |
# | |
# output | |
# client: 10.10.100.100 | |
cat error.log | grep client | awk 'BEGIN {FS="client: "}{print "client: "$2}' | cut -d "," -f 1 |
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
echo "*" | redis-cli keys | sed "s/\s/\n/g" | cut -d ":" -f 2 | sort -n | more |
OlderNewer