Skip to content

Instantly share code, notes, and snippets.

View krabello's full-sized avatar

Kevin Rabello krabello

  • Stetson University
  • DeLand, Florida
View GitHub Profile
@krabello
krabello / session.php
Created November 10, 2021 18:09
Session Start
<?php
if (session_status() == PHP_SESSION_NONE) {
// Prevents javascript XSS attacks aimed to steal the session ID
ini_set('session.cookie_httponly', '1');
// ** PREVENTING SESSION FIXATION **
// Session ID cannot be passed through URLs
ini_set('session.use_only_cookies', '1');
@bradtraversy
bradtraversy / mongodb_cheat_sheet.md
Last active April 25, 2024 22:38
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@exAspArk
exAspArk / self-signed-ssl-mongo.sh
Last active April 6, 2024 19:38
Self-signed SSL Certificate with OpenSSL on MacOS | MongoDB
openssl genrsa -out CAroot.key 2048
openssl req -new -key CAroot.key -out CAroot.csr # CN should be different from the certificates below
openssl req -x509 -days 1825 -key CAroot.key -in CAroot.csr -out CAroot.crt
cat CAroot.crt CAroot.key > CAroot.pem
openssl genrsa -out mongod.key 2048
openssl req -new -key mongod.key -out mongod.csr
openssl x509 -req -days 1825 -in mongod.csr -CA CAroot.pem -CAkey CAroot.key -CAcreateserial -out mongod.crt
cat mongod.crt mongod.key > mongod.pem
@krabello
krabello / convert-audio-to-video.sh
Created May 19, 2017 18:46
Converts a Audio file and image to video. In order to be used on youtube
#!/bin/sh
# example line
# 372|"Baby Beluga CD"|Raffi8054BabyBeluga.mp3|http://www.domain.com/img/data/ETA_CD56.jpg
while IFS='|' read field1 field2 field3 field4 || [[ -n "$line" ]]; do
f=$(echo $field2 | tr -d '"' | tr -d ' ' | tr -d '®' | tr -d "'" | tr -d '‘' | tr -d '’' | tr -d '&' | tr -d ',' | tr -d '-')
ffmpeg -loop 1 -i $field4 -i $field3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest ./out/$f.mp4 < /dev/null
done < "$1"
@lcobucci
lcobucci / .bashrc
Last active February 15, 2023 11:45
My dot files
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
if [ -f /usr/share/git-core/contrib/completion/git-prompt.sh ]; then
source /usr/share/git-core/contrib/completion/git-prompt.sh
fi

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@vasanthk
vasanthk / System Design.md
Last active April 26, 2024 18:05
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@JeffreyWay
JeffreyWay / countries.php
Created July 23, 2015 17:01
Country Names + Codes
[
"United States" => "us",
"Afghanistan" => "af",
"Albania" => "al",
"Algeria" => "dz",
"American Samoa" => "as",
"Andorra" => "ad",
"Angola" => "ad",
"Anguilla" => "ai",
"Antarctica" => "aq",
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 26, 2024 17:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@ravanscafi
ravanscafi / _readme.md
Last active June 22, 2019 14:42
Proper way to use LiveReload with Laravel Elixir

Proper way to use LiveReload with Laravel Elixir

Features

  • It works without touching laravel-elixir source files, so it will not break on updates.
  • It runs only on watch task, so that when you run other tasks, livereload will not start and hang the console.
  • It performs soft-reloads on CSS changes, instead of a full page reload.

Instructions

  1. npm install gulp-livereload if you still don't have it.
  2. Create an elixir.json file on the root of your project (where your gulpfile.js is located)