Skip to content

Instantly share code, notes, and snippets.

View DefrostedTuna's full-sized avatar

Rick Bennett DefrostedTuna

View GitHub Profile
@stephenmm
stephenmm / file_menu2.bash
Created July 12, 2018 20:23
Interactive and visual selection of array with arrows or 'j' 'k' keys. Can also edit (with autocomplete) the selection
#!/usr/bin/env bash
# Started from this code: https://unix.stackexchange.com/a/415155/14014
# Renders a text based list of options that can be selected by the
# user using up, down, 'j', 'k', and enter keys and returns the
# string in provided file.
# 'e' to edit the current string
# 'q' to quit
#
# Arguments : list of options, maximum of 256
@michaelbunch
michaelbunch / readme.md
Last active May 29, 2018 21:01
Interview Development Task

Interview Development Task

Task

Your users would like a service for sharing bookmarks with one other. The service should have authentication to keep the bookmarks private to only registered users. Once authenticated all bookmarks are visible by all users. A user can post a new bookmark for all to see, but only that user can edit or delete the bookmark. All users like the to see the bookmarks in alphabetical order by title. New users can join the service via a public registration page.

Estimated time to complete: 3 - 4 hours

@ryantbrown
ryantbrown / s3upload.sh
Created February 1, 2018 07:25
Bash script to Upload folder to S3
# Set AWS credentials and S3 paramters
AWS_KEY=""
AWS_SECRET=""
S3_BUCKET=""
S3_BUCKET_PATH="/"
S3_ACL="x-amz-acl:private"
function s3Upload
{
path=$1
@javilobo8
javilobo8 / download-file.js
Last active April 9, 2024 12:01
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@viralsolani
viralsolani / phpunit.xml
Created May 9, 2017 12:16
phpunit.xml Laravel 5.4 with sqlite memory database
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
@kyleferguson
kyleferguson / Dockerfile
Last active December 19, 2023 06:10
Example Laravel deployment for Kubernetes
FROM php:7.1-apache
ADD . /var/www
ADD ./site.conf /etc/apache2/sites-enabled/000-default.conf
RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client && \
docker-php-ext-install mcrypt pdo_mysql opcache && \
pecl install redis-3.1.2 && docker-php-ext-enable redis && \
a2enmod rewrite
1 - Install Home Brew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2 - Install aircrack-ng:
brew install aircrack-ng
3 - Install the latest Xcode, with the Command Line Tools.
//Create the following symlink:
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport//Figure out which channel you need to sniff:
@isuzuki
isuzuki / .php_cs
Last active September 26, 2022 19:58
Config for PHP-CS-Fixer ver 2 (based on laravel .php_cs https://github.com/laravel/framework/blob/5.4/.php_cs)
<?php
/**
* Config for PHP-CS-Fixer ver2
*/
$rules = [
'@PSR2' => true,
// addtional rules
@sknuell
sknuell / PHPNativeFunctionMock.php
Last active February 10, 2021 22:22
Mocking native PHP functions (date(), time() and shell_exec) for PHPUnit using php-mock/php-mock and php-mock/php-mock-phpunit
<?php
namespace Foo\Bar;
use phpmock\MockBuilder;
use phpmock\phpunit\PHPMock;
use PHPUnit_Framework_TestCase;
class Baz
{
/**