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
# iterates over each file in source directory | |
# and moves to target directory under folders by file type | |
# I'm using this to automatically cleanup my Downloads folder on Windows 10 | |
# which always looked like a mess before | |
from os import listdir, path, mkdir, rename | |
import shutil | |
inputDir = 'C:/Users/{user}/Downloads' | |
outputDir = 'G:/Downloads' |
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 | |
// My smartphone Note 8 outputs really heavy size videos. So I wrote this script | |
// to automatically convert videos in given directory | |
$inputDir = 'directory_with_all_videos'; | |
$outputDir = 'directory_to_save_converted_videos_to'; | |
$files = glob($inputDir); |
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 | |
// Requires FFMPEG to be installed and globally available | |
// Been using this to rotate videos shot on a phone with dead sensors | |
if (!$argv['1']) { exit("php rotate_360.php input_dir output_dir degress_to_rot"); } | |
$input_dir = $argv['1']; | |
$output_dir = $argv['2']; | |
if (!file_exists($output_dir)) { @mkdir($output_dir); } |
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 | |
$query = "alter table {table} drop column columnName;"; | |
$tables = array('tableA', 'tableB'); | |
foreach ($tables as $key => $source) { | |
$currentQuery = str_replace('{table}', $source, $query); | |
DB::query($currentQuery); | |
} |
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 | |
// requires Mailgun PHP SDK https://github.com/mailgun/mailgun-php | |
require 'vendor/autoload.php'; | |
use Mailgun\Mailgun; | |
function sendMail($params) { | |
$from = isset($params['from']) ? $params['from'] : '[email protected]'; | |
$mailParams = array(); | |
$attachments = array(); |
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 | |
// Please replace TABLE:: actions with your own DB class | |
// I wrote this class while working with a Laravel based project | |
// Function is also being used in a project of mine called BriskLimbs | |
public function list($parameters = array()) { | |
$fields = array('*'); | |
$limit = $this->limit; | |
if (!empty($parameters['limit'])) { |
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
import random, logging | |
from datetime import datetime, timedelta, date | |
class ProxiesRotation(object): | |
"""docstring for ProxiesRotation""" | |
def __init__(self, directory): | |
super(ProxiesRotation, self).__init__() | |
self.proxies = [] | |
self.forbidden_proxies = [] | |
self.directory = directory | |
self.usedProxies = {} |