Skip to content

Instantly share code, notes, and snippets.

View GideonBabu's full-sized avatar
💭
Looking for a challenging opportunity

Gideon Babu GideonBabu

💭
Looking for a challenging opportunity
View GitHub Profile
@GideonBabu
GideonBabu / gitcommands.txt
Last active August 26, 2020 19:09
Useful Git Commands
git clone [git URL] - to clone the URL from gitlab/github/bitbucket
git branch -a - to list current to remote branch
git checkout [branch name] - to move/checkout to branch name
git status - to view the status of the local files and remote branch files in cloud
git diff [file] - to view the different between local and remove file
git add [files with a space] - to add new files to the repo
git commit -m "commit msg" - to commit with message
git push - push the code to the repo
# add remote
@GideonBabu
GideonBabu / magento2-logrotate.conf
Created December 12, 2018 07:43
Magento 2 Log rotate
/var/www/html/var/log/*.log {
daily
missingok
rotate 14
compress
notifempty
create 0777 magento2-file-username magento2-file-username
}
@GideonBabu
GideonBabu / Useful_PHP_Scripts.txt
Last active January 15, 2020 10:37
Useful PHP Scripts
To split the date and time from datetime value
$date = strtotime('8/29/2011 11:16:12 AM');
$dat = date('m/d/y', $date);
$tme = date('H:m:s A',$date);
ucfirst() - makes the first letter of the input string uppercase.
upfirst('hello world!') - returns 'Hello world!';
@GideonBabu
GideonBabu / example-app
Created November 22, 2018 13:33
Setup Logrotate on the server
/var/www/html/var/log/*.log {
daily
missingok
rotate 14
compress
notifempty
create 0777 www-data www-data
}
setup cron job
@GideonBabu
GideonBabu / Useful MySql Commands
Last active November 6, 2019 15:15
Useful MySQL Commands
ALTER TABLE master_activity_log CHANGE `from_user_id` `user_id` INT(11); // change column name
ALTER TABLE master_activity_log DROP log_date; // remove column
ALTER TABLE master_activity_log ADD COLUMN log_datetime DATETIME AFTER after_save; // create new column of existing table
Truncate foreign key constraints table :
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `table name`;
SET FOREIGN_KEY_CHECKS=1;
@GideonBabu
GideonBabu / magento2_reset_password.txt
Created October 23, 2018 13:47
Magento 2 Reset Customer Password SQL query
UPDATE `customer_entity`
SET `password_hash` = CONCAT(SHA2('xxxxxxxxYOURPASSWORD', 256), ':xxxxxxxx:1') // change YOURPASSWORD to your password to reset
WHERE `entity_id` = 19975 and `email`="gideon.b@domain.com";
@GideonBabu
GideonBabu / db-insert.txt
Created September 29, 2018 20:02
Python MySQLDB insert
#!/usr/bin/python
import MySQLdb
import datetime
# Open database connection
db = MySQLdb.connect("localhost","root","","know_your_beat" )
# prepare a cursor object using cursor() method
cursor = db.cursor()
@GideonBabu
GideonBabu / android-push.php
Created September 28, 2018 07:40
PHP Script to send push notification to android
<?php
define( 'API_ACCESS_KEY', 'AIzaSyA7TJAvFZrD_asZM92xoWM5u5MD-uMyYH0' );
$registrationIds = array(
"cQ8E8TvwQxg:APA91bHGxk5NBPze0_zOTQLif9s5VpOYzCyEvPmFlP3PD5FI6_5LyIVNkTKlfpSS9wy4SpO5iIX7Jdvp3nNLMYvCk6IbNRE_ykplP-Es8ebuJPF_tHhhzVS6TjWS5gDlC0Fp8JIkckNy",
"d5ttcEFtdg8:APA91bGu7QvkTkGKi4l6GviGCYgSQsv0bRLmgxlbJCDmM6iBmcOT5XAtwyQ1vprQCeTIkAvXwxb_IlitoQF335ynDyrvZXRTaN8HgDe8WFf__RI06ahec1yx0EbwkuzUI5h_s5WWP_tl"
);
$msg = array
(
'body' => 'The Chennai Silks',
'title'=> 'Welcome to TCS!',
@GideonBabu
GideonBabu / prevent-cut-copy-text-pwd-field.html
Created September 7, 2018 10:15
To prevent cut copy paste in text field
onselectstart="return false" onpaste="return false;" onCopy="return false" onCut="return false" onDrag="return false" onDrop="return false" autocomplete=off
@GideonBabu
GideonBabu / wp.txt
Created August 24, 2018 10:35
wordpress download from ssh
ssh username@domain.com -p 22
cd public_html/blogdemo/
wget http://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
mv wordpress/* ./
rmdir ./wordpress/
rm -f latest.tar.gz