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
use test; | |
create table t1 ( id int not null auto_increment primary key, value varchar(20)); | |
insert into t1 (value) | |
select 'ass' | |
union all | |
select 'foo' | |
union all | |
select 'bar' | |
union all |
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 count(*) from | |
sakila.actor; | |
select * from sakila.actor; | |
select "foo" as "boo"; | |
select actor_id, first_name, last_name | |
from sakila.actor | |
where actor_id > 100 |
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
create table employees( | |
employee_id INT NOT NULL AUTO_INCREMENT, | |
employee_title VARCHAR(100) NOT NULL, | |
employee_author VARCHAR(40) NOT NULL, | |
submission_date DATE, | |
PRIMARY KEY ( employee_id ) | |
); | |
create table titles ( | |
id INT NOT NULL AUTO_INCREMENT, | |
title VARCHAR(100) NOT NULL, |
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
The RewriteCond directive just describes an additional condition for a RewriteRule directive. So RewriteCond must always be associated with a RewriteRule. | |
In your case the three RewriteCond probably belong to the first RewriteRule like this: | |
RewriteCond %{REQUEST_FILENAME} -s [OR] | |
RewriteCond %{REQUEST_FILENAME} -l [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^.*$ - [NC,L] | |
Now this rule is applied if the pattern of the RewriteRule matches the current request URL (per-directory path stripped before) and if the condition is fulfilled. |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_COOKIE} !cfn-auth-cookie=abhishekpareek; [NC] | |
RewriteRule ^ http://www.google.com [NC,L] | |
RewriteCond %{REQUEST_URI} ^/xml.*$ [NC] | |
RewriteRule ^.*$ - [R=404,L] |
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 = sc.textFile("/vagrant/access_log-20160828") | |
>>> xmlrpc_attack = input.filter(lambda x: "xmlrpc.php" in x) | |
>>> attacking_ips=xmlrpc_attack.filter(lambda x: '12.0.1.8' not in x).map(lambda x: x.split()[0]) | |
>>> counts = attacking_ips.map(lambda ip: (ip,1)) | |
>>> total = counts.reduceByKey(lambda x,y : x+y) | |
>>> total.foreach(print) | |
(u'185.106.122.248', 57) | |
(u'163.172.149.145', 2376) | |
(u'89.248.174.4', 4) | |
(u'163.172.179.35', 741) |
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
>>> # count word occurences in a file | |
>>> input.flatMap(lambda x: x.split(' ')).map(lambda x: (x,1)).reduceByKey(lambda x, y: x+y).collect() | |
[(u'', 68), (u'when', 1), (u'R,', 1), (u'including', 3), (u'computation', 1), (u'using:', 1), (u'guidance', 2), (u'Scala,', 1), (u'environment', 1), (u'only', 1), (u'rich', 1), (u'Apache', 1), (u'sc.parallelize(range(1000)).count()', 1), (u'Building', 1), (u'And', 1), (u'guide,', 1), (u'return', 2), (u'Please', 3), (u'[Eclipse](https://cwiki.apache.org/confluence/display/SPARK/Useful+Developer+Tools#UsefulDeveloperTools-Eclipse)', 1), (u'Try', 1), (u'not', 1), (u'Spark', 15), (u'scala>', 1), (u'Note', 1), (u'cluster.', 1), (u'./bin/pyspark', 1), (u'params', 1), (u'through', 1), (u'GraphX', 1), (u'[run', 1), (u'abbreviated', 1), (u'For', 3), (u'##', 8), (u'library', 1), (u'see', 3), (u'"local"', 1), (u'[Apache', 1), (u'will', 1), (u'#', 1), (u'processing,', 1), (u'for', 11), (u'[building', 1), (u'Maven', 1), (u'["Parallel', 1), (u'provides', 1), (u'print', 1), (u'suppor |
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
w uses the access time of the tty to determine how idle someone is, this is covered in idletime() | |
which stats the tty file and subtracts its atime from the current time. pkill can use a terminal as the filter | |
to kill processes. | |
So, you want to kill anyone who isn't root and idle for over 5 minutes? | |
for t in `w -h | grep -v '^root' | awk '{print $2}'`; do find /dev/$t -amin +5 -exec pkill -t $t \; ; done | |
What is going on here: | |
Use w with no headers to find all users |
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
############## | |
# xprintidle # | |
############## | |
# install xprintidle dependencies | |
sudo yum -y install libXScrnSaver-devel libX11-devel | |
# download xprintidle source | |
wget https://launchpad.net/ubuntu/+archive/primary/+files/xprintidle_0.2.orig.tar.gz | |
# extract | |
tar -xf xprintidle_0.2.orig.tar.gz | |
cd xprintidle-0.2/ |
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
obj-m += tcp_svr_sample.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea |