Skip to content

Instantly share code, notes, and snippets.

@ursuleacv
ursuleacv / sublime.txt
Last active March 4, 2020 15:55
Sublime append comma after numbers regex
# multi curstor edit
select all
CTRL + SHIFT + L
# Add comma after every string
find: (.*+$)
replace: $1,
# Add comma after every number
find: (^\d+$)
@ursuleacv
ursuleacv / index.html
Last active June 13, 2016 13:39
A very simple modal dialog
DEMO: https://jsfiddle.net/k3zfzxgx/
<!-- HTML -->
<div id="loginModal" class="modal">
<div class="modal-content modal-login">
<div class="modal-header">
<span class="modal-close">×</span>
<h2>My title</h2>
</div>
<div class="modal-body">
php yiic.php rresque stop
php yiic.php rresque start --count=1
ps aux | grep resque
@ursuleacv
ursuleacv / gist:cb36de7a0b14d1a7054f
Created November 24, 2015 19:53
Media Queries for Standard Devices
/* ----------- Non-Retina Screens ----------- */
@media screen
and (min-device-width: 1200px)
and (max-device-width: 1600px)
and (-webkit-min-device-pixel-ratio: 1) {
}
/* ----------- Retina Screens ----------- */
@media screen
and (min-device-width: 1200px)
@ursuleacv
ursuleacv / gist:921cd6eb5179a0120f4f
Created September 12, 2015 19:50
Apache could not start. Address already in use
sudo netstat -ltnp | grep ':80'
This would return the following:
tcp 0 0 :::80 :::* LISTEN 1047/httpd
Then I ran the following command:
sudo kill -9 1047
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@ursuleacv
ursuleacv / gist:92d7d91323448aaade34
Last active August 29, 2015 14:16
Iptables Block Baidu Spider
iptables -A INPUT -s 119.63.193.0/24 -j DROP
iptables -A INPUT -s 180.76.0.0/20 -j DROP
iptables -A INPUT -s 180.76.2.0/24 -j DROP
iptables -A INPUT -s 180.76.3.0/24 -j DROP
iptables -A INPUT -s 180.76.5.0/24 -j DROP
iptables -A INPUT -s 180.76.6.0/24 -j DROP
iptables -A INPUT -s 180.76.8.0/24 -j DROP
iptables -A INPUT -s 180.76.9.0/24 -j DROP
iptables -A INPUT -s 180.76.11.0/24 -j DROP
iptables -A INPUT -s 180.76.12.0/24 -j DROP
@ursuleacv
ursuleacv / gist:0a24821e0b6694a389bb
Last active August 29, 2015 14:16
Yii Framework : format log message - add ip address
class YourFileLogRoute extends CFileLogRoute
{
protected function formatLogMessage($message,$level,$category,$time)
{
return @date('Y/m/d H:i:s',$time)." [". Yii::app()->request->userHostAddress."]"." [$level] [$category] $message\n";
}
}
# Do not insert 404 error in logs file
# http://www.yiiframework.com/forum/index.php?/topic/22510-no-route-chttpexception/page__p__110030__fromsearch__1#entry110030
php cron.php sendpinsmsemail fill > fill.txt
php cron.php sendpinsmsemail send > send.txt
@ursuleacv
ursuleacv / gist:2b8fb4e5f449d28b83db
Created March 6, 2015 22:36
How to Reset MySQL root Password on CentOS
Stop the MySQL process
$ service mysqld stop
Once MySQL has stopped
Restart it with the --skip-grant-tables option
$ mysqld_safe --skip-grant-tables &
Connect to MySQL using the root user.
$ mysql -u root