Skip to content

Instantly share code, notes, and snippets.

View malkafly's full-sized avatar
🏠
Working from home

d. malk malkafly

🏠
Working from home
View GitHub Profile
@malkafly
malkafly / laravel-permissions
Created January 8, 2019 22:13
Laravel Directory Permissions
sudo chown -R www-data:www-data .
sudo usermod -a -G www-data admin
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
@malkafly
malkafly / teste.json
Last active December 14, 2018 16:43
teste api xp
{"swagger": "2.0","info": { "version": "2018.11.6.114634","title": "SAK.Test.ApplicationLab","description": "A sample API that uses a Http2RpcProvider provider as an example to demonstrate features in SAK","license": {"name": "MIT"}},"host": "localhost:20319","basePath": "/","schemes": ["http"],"consumes": ["application/json"],"produces": ["application/json"],"paths": { "/apitestservice/v1/customers": {"get": { "operationId": "GetCustomers","summary": "Método: GetCustomers","produces": [ "application/json" ],"responses": { "200": { "description": "200 response" }}},"post": { "operationId": "PostCustomers","summary": "Método: PostCustomers","produces": [ "application/json" ],"responses": { "200": { "description": "200 response" }}}},"/apitestservice/v1/customers/:id": {"get": { "operationId": "GetSingleCustomers","summary": "Método: GetSingleCustomers","produces": [ "application/json" ],"responses": { "200": { "description": "200 response" }}},"post": { "operationId": "PostCustomersById","summary": "Método: P
@malkafly
malkafly / laravel-voyager.md
Created November 29, 2018 12:56
Laravel Voyager - Show only the records assigned to a user

Figured out a decent solution. Add to AppServiceProvider@register:

$this->app->bind('TCG\Voyager\Models\Post', function ($app) {
    return new App\Post;
});

Create the new model that extends Voyager's model, and use a conditional addGlobalScope:

@malkafly
malkafly / bitbucket-pipelines.yml
Created November 22, 2018 10:52 — forked from mcnamee/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add $FTP_USERNAME $FTP_PASSWORD and $FTP_HOST as environment variables.
# 2. Commit this file to your repo
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initial GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you
@malkafly
malkafly / teste.json
Created November 19, 2018 13:40
teste
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@malkafly
malkafly / homestead.yaml
Last active July 27, 2019 13:00
Homestead Arquitecasa
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
mongodb: true
authorize: ~/.ssh/id_rsa.pub
keys:
@malkafly
malkafly / gist:f8f76878cc4e75900f7482354d69d3ef
Created September 19, 2018 23:14 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@malkafly
malkafly / construcao.json
Last active August 30, 2018 11:34
teste
{
"result": {
"totals": {
"manpowers": "111.760,00",
"materials": "123.325,01",
"total": "235.085,01"
},
"manpowers": [
{
"id": 6,
C:\Program Files\Oracle\VirtualBox\VBOXMANAGE.EXE internalcommands sethduuid C:\Users\dcosta\VirtualBoxVMs\ubuntuMalk\ubuntuMalk.vdi
@malkafly
malkafly / mysql_outfile.sql
Created June 1, 2018 12:56 — forked from reyesyang/mysql_outfile.sql
Export MySQL query result to CSV file
SELECT id, username, (total_point - spent_point) AS point
FROM users
ORDER BY point DESC
LIMIT 50
INTO OUTFILE '/tmp/bbs_points_top50.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
;