Skip to content

Instantly share code, notes, and snippets.

View naneri's full-sized avatar
👔

Kana naneri

👔
View GitHub Profile
@naneri
naneri / cheats.sh
Last active December 4, 2022 23:10
My bash cheatsheet
# ==========
# Laravel
# ==========
# Laravel folder permissions
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
# ==========
# SSH
FROM php:7.4-fpm
# Install any needed packages
RUN apt-get update -yqq && \
apt-get install -yqq --no-install-recommends \
apt-utils \
openssl \
libzip-dev zip unzip \
git \
mariadb-client \
@naneri
naneri / docker-compose.yml
Created January 5, 2020 14:08
docker-compose.yml
version: '2'
services:
# app with php container
app:
restart: unless-stopped
build:
context: ./
dockerfile: app.docker
volumes:
@naneri
naneri / add_record_to_hosts.sh
Created September 2, 2018 17:15
Add a new line to hosts
echo 192.168.33.199 chef-automate.test | sudo tee -a /etc/hosts
@naneri
naneri / laravel.js
Created May 1, 2018 15:26
The delete button with my own csrf_token
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{ csrf_token() }}" data-confirm="Are you sure?">
*/
(function() {
@naneri
naneri / deploy.sh
Created September 18, 2017 08:08
deploy.sh
#!/bin/bash
currentFolder=${PWD##*/}
echo -e "$Cyan \n Updating System.. $Color_Off"
sudo apt-get update -y && sudo apt-get upgrade -y
echo -e "$Cyan \n Installing Apache2 $Color_Off"
sudo apt-get install apache2
@naneri
naneri / query.sql
Created May 20, 2017 10:01
$fLat is the searchers latitude and $fLon the searchers longitude.
SELECT
`id`,
`name`
FROM
`stations`
WHERE
ACOS( SIN( RADIANS( `latitude` ) ) * SIN( RADIANS( $fLat ) ) + COS( RADIANS( `latitude` ) )
* COS( RADIANS( $fLat )) * COS( RADIANS( `longitude` ) - RADIANS( $fLon )) ) * 6380 < 10
ORDER BY
`distance`
@naneri
naneri / select.blade.php
Created October 4, 2016 08:50
Laravel select
<select name="metrics_reminder" class="form-control list-group-item" required>
<option value="never" @if(old('course_reminder', $user->metrics_reminder) == 'never') selected @endif>Never</option>
@foreach(config('anya.metrics_reminder_intervals') as $value)
<option value="{{$value}}" @if(old('course_reminder', $user->metrics_reminder) == $value) selected @endif>
Once in {{$value}} days
</option>
@endforeach
</select>
@naneri
naneri / add_identity.sh
Last active July 29, 2016 11:31
Adds ssh identity to a server
cat ~/.ssh/id_rsa.pub | ssh user@123.45.56.78 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"