This file contains hidden or 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
#!/usr/bin/python3 | |
#Scraping wikipedia page according to your command line input | |
import sys | |
import requests | |
import bs4 | |
RED = '\033[31m' | |
END = '\033[0m' | |
ascii_art = RED \ | |
+ """ |
This file contains hidden or 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 | |
namespace App\Http\Controllers; | |
use DB; | |
use Config; | |
use App\Models\Course; | |
use Illuminate\Http\Request; | |
use Yajra\Datatables\Datatables; | |
use Illuminate\Support\Facades\Validator; |
This file contains hidden or 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 | |
// indexed array examples | |
$list = array( 'mango', 'apple', 'grape', 'orange' ); | |
// or | |
$list = [ 'mango', 'apple', 'grape', 'orange' ]; | |
//or | |
$list = array(); |
This file contains hidden or 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 strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv); |
This file contains hidden or 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 | |
// routes/console.php | |
// quickly create an user via the command line | |
Artisan::command('user:create', function () { | |
$name = $this->ask('Name?'); | |
$email = $this->ask('Email?'); | |
$pwd = $this->ask('Password?'); | |
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted | |
\DB::table('users')->insert([ |
This file contains hidden or 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 | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
/* | |
| | |
| Library for record all activity | |
| K4ng | |
| | |
*/ | |
This file contains hidden or 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 | |
// this script would save csv file to this specified directory | |
// APPPATH is location of application folder in Codeigniter | |
$file = fopen(APPPATH . '/../upload/'.'tesaasasat.csv', 'wb'); | |
// set the column headers | |
fputcsv($file, array('Column 1', 'Column 2', 'Column 3', 'Column 4', 'Column 5')); | |
// Sample data. This can be fetched from mysql too | |
$data = array( |
This file contains hidden or 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
error: function (request) { | |
// Validation error would return 422 header | |
if (request.status == 422) { | |
// Parser the json response expected | |
var $errors = $.parseJSON(request.responseText); | |
// Bootstrap alert scafolding for error | |
var errorsHtml = '<div class="alert alert-danger alert-dismissible"><button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button><h4><i class="icon fa fa-times"></i>Opps! Seems like you didn\'t fill the form properly...</h4><ul>'; | |
// The root nodes are field names, with an array of error messages | |
$.each( $errors, function( key, value ) { | |
// We loop through the error to see if there are multiple error associated with the field |
This file contains hidden or 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 | |
// PHP script to allow periodic cPanel backups automatically, optionally to a remote FTP server. | |
// Cron Job Command: /usr/local/bin/php /home/<cpanel-username>/fullbackup.php | |
// This script contains passwords. It is important to keep access to this file secure (we would ask you to place it in your home directory, not public_html) | |
// You need create 'backups' folder in your home directory ( or any other folder that you would like to store your backups in ). | |
// ********* THE FOLLOWING ITEMS NEED TO BE CONFIGURED ********* |
This file contains hidden or 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
//searchText is a input type text | |
$('#searchText').bind('keyup', function() { | |
var searchString = $(this).val(); | |
$("ul li").each(function(index, value) { | |
currentName = $(value).text() | |
if( currentName.toUpperCase().indexOf(searchString.toUpperCase()) > -1) { |
NewerOlder