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
function gdrive_download () { | |
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p') | |
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2 | |
rm -rf /tmp/cookies.txt | |
} | |
gdrive_download 0B-x0PDB0WVsieWVSRk5uWkVCeE0 test.zip | |
#gdrive_download <File ID> <File 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
#Structure With Data Backup | |
DATABASE_LIST=$(mysql -NBe 'show schemas' | grep -wv 'mysql\|personnel\|buildings\|information_schema\|performance_schema');echo $DATABASE_LIST;mysqldump --databases $DATABASE_LIST > bk.sql | |
#Structure only backup | |
DATABASE_LIST=$(mysql -NBe 'show schemas' | grep -wv 'mysql\|personnel\|buildings\|information_schema\|performance_schema');echo $DATABASE_LIST;mysqldump --no-data --databases $DATABASE_LIST > structure.sql | |
#Restore/Install/Dump sql file | |
mysql -uroot -p < database_backup.sql |
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
<?php | |
function dua_get_files($path) | |
{ //deep scan directory path | |
$data = array(); | |
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); | |
foreach ($files as $file) | |
{ | |
if (is_dir($file) === true) |
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
cd /home/directoy; grep -nr 'yourString*' | |
grep -r --include=.txt 'searchterm' ./ ...or case-insensitive version... grep -r -i --include=.txt 'searchterm' ./ // /home/directory location directory, find string,word yourString* (* means after yourString any thing word character) ---Find And Replace String or word cd /home/directoy; grep -rl FindString | xargs sed -i 's/FindString/ReplaceString/g' | |
example: find google.in string and replace with yahoo.com cd /home/directoy; grep -rl google.in | xargs sed -i 's/google.in/yahoo.com/g' | |
grep -rl --include=.php campaign12 | xargs sed -i 's/campaign12/campaign1/g' | |
grep -rl --include=\*.php campaign12 | xargs sed -i 's/campaign12/campaign1/g' | |
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
<?php | |
$MainPath='./'; | |
function dua_get_files($path) { //deep scan directory path | |
$data = array(); | |
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); | |
foreach ($files as $file) { | |
if (is_dir($file) === true) { | |
$data[] = strval($file); | |
} |
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
<?php | |
$json ='[ | |
{ | |
"id": 8, | |
"parent": 4, | |
"name": "Food & Lifestyle" | |
}, | |
{ | |
"id": 2, | |
"parent": 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
#!/bin/bash | |
fileid="FILEIDENTIFIER" | |
filename="FILENAME" | |
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${fileid}" > /dev/null | |
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${fileid}" -o ${filename} |
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
##multiple user permission file access read/write permission | |
[Project2] | |
browseable = yes | |
writeable = yes | |
path = /var/www/html | |
force user = root | |
read list =@root, @amoluser | |
write list = @root, @amoluser | |
create mode = 0644 | |
public = yes |
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
<?php | |
/* | |
Have a function Arr(strArr) read the array of strings stored in strArr which will contain only two elements, both of which will represent an array of positive integers. For example of strArr is ["[1, 2, 5, 6]", "[5, 2, 8, 11]"], and goal for this is to add the elements in corresponding locations from both arrays. For the example input, the program should do the following additions: [(1 + 5), (2 + 2), (5 + 8), (6 + 11)] which then equals [6, 4, 13, 17]. Return this resulting array in a string format with each element separated by a hyphen: 6-4-13-17. | |
If the two arrays do not have the same amount of elements, then simply append the remaining elements onto the new array. | |
Examples | |
Input: ["[5, 2, 3]", "[2, 2, 3, 10, 6]"] | |
Output: 7-4-6-10-6 |
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
<?php | |
/* | |
Array Challenge | |
Have the function ArrayChallenge(num) take the num parameter being passed and perform the following steps. First take all the single digits of the input number (which will always be a positive integer greater than 1) and add each of them into a list. Then take the input number and multiply it by any one of its own integers, then take this new number and append each of the digits onto the original list. Continue this process until an adjacent pair of the same number appears in the list. Your program should return the least number of multiplications it took to find an adjacent pair of duplicate numbers. | |
For example: if num is 134 then first append each of the integers into a list: [1, 3, 4]. Now if we take 134 and multiply it by 3 (which is one of its own integers), we get 402. Now if we append each of these new integers to the list, we get: [1, 3, 4, 4, 0, 2]. We found an adjacent pair of duplicate numbers, namely 4 and 4. So for this input your program should return 1 because it only |
OlderNewer