Skip to content

Instantly share code, notes, and snippets.

@hardevine
hardevine / scrape_with_logs.py
Created September 9, 2021 09:56 — forked from rengler33/scrape_with_logs.py
How to Capture Network Traffic When Scraping with Selenium & Python
# see rkengler.com for related blog post
# https://www.rkengler.com/how-to-capture-network-traffic-when-scraping-with-selenium-and-python/
import json
import pprint
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
capabilities = DesiredCapabilities.CHROME
@hardevine
hardevine / wait_for_reload.php
Created August 12, 2020 16:31 — forked from calebporzio/wait_for_reload.php
Simple Laravel Dusk macro that waits for a page change
<?php
// Define in some ServiceProvider
Browser::macro('waitForReload', function () {
$this->script("window.duskPageIsStale = {}");
return $this->waitUntil("return typeof window.duskPageIsStale === 'undefined';");
});
// Usage:
@hardevine
hardevine / LaravelCookieDecrypter.php
Created May 4, 2020 10:27 — forked from glennkarlsen/LaravelCookieDecrypter.php
Decrypt laravel_session outside of the Laravel app. This is just a proof of concept, cleanup and extend to your needs.
<?php
class LaravelCookieDecrypter {
/**
* The encryption key.
*
* @var string
*/
protected $key = 'YOUR LARAVEL .ENV APP KEY';
@hardevine
hardevine / .gitignore
Created May 4, 2020 07:03 — forked from sendoa/.gitignore
Sendoa's .gitignore for Laravel+PHPStorm projects
/node_modules
/public/storage
/storage/*.key
/vendor
Homestead.yaml
Homestead.json
.env
# ====== OS X ===========================================
.DS_Store
@hardevine
hardevine / latest-ffmpeg-centos6.sh
Last active March 26, 2020 13:36 — forked from mustafaturan/latest-ffmpeg-centos6.sh
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
@hardevine
hardevine / errorHandler.js
Created March 14, 2020 05:53 — forked from saqueib/errorHandler.js
Global error handling using axios interceptor for http calls http://www.qcode.in/api-error-handling-in-vue-with-axios
import axios from 'axios'
import toast from './toast'
function errorResponseHandler(error) {
// check for errorHandle config
if( error.config.hasOwnProperty('errorHandle') && error.config.errorHandle === false ) {
return Promise.reject(error);
}
// if has response show the error
// https://stackoverflow.com/questions/16104078/appending-array-to-formdata-and-send-via-ajax/28434829#28434829
// https://stackoverflow.com/questions/17066875/how-to-inspect-formdata
var myFormData = {
key1: 300,
key2: 'hello world'
};
var fd = new FormData();
for (var key in myFormData) {
console.log(key, myFormData[key]);
fd.append(key, myFormData[key]);
<?php
// Snippet from PHP Share: http://www.phpshare.org
function formatSizeUnits($bytes)
{
if ($bytes >= 1073741824)
{
$bytes = number_format($bytes / 1073741824, 2) . ' GB';
}
elseif ($bytes >= 1048576)
@hardevine
hardevine / SkipVerification.txt
Created December 9, 2019 12:05 — forked from ygit/SkipVerification.txt
Skip Verification of Mac Apps
xattr -d com.apple.quarantine /path/to/app/myMacApp.app