Skip to content

Instantly share code, notes, and snippets.

*/5 * * * * curl http://www.example.com
Add/Edit CRON job:
crontab -e
VIM Commands:
Insert a line - ESC -> I
Save - :w
Quit - :q
@nosajhpled
nosajhpled / AWS SFTP User
Created June 19, 2018 15:29
Create a new user to SFTP into an AWS EC2 Server
Create User
------------
sudo adduser <new user> && sudo su - <new user> && cd /home/<new user>
Create SSH
----------
mkdir .ssh && chmod 700 .ssh && touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
ssh-keygen -f <new user> && cat <new user>.pub >> /home/<new user>/.ssh/authorized_keys
Copy Private Key To Give to New User
@nosajhpled
nosajhpled / gist:893dc1819aa629d5c69510f71cf59914
Last active July 6, 2018 20:44
Create Certificate Request on Apache
** This is instructions to create a certificate request
** on AWS with Apahce
cd /etc/pki/tls/certs/
sudo openssl req -new -newkey rsa:2048 -nodes -keyout <domain name>.key -out <domain name>.csr
** Remember to use full domain name (www.domainname.com) when asked when asked for common name
** Copy the text from <domain name>.csr to create the certificate for whatever company
@nosajhpled
nosajhpled / C# – Extract filename from a full path
Last active August 31, 2018 20:26
C# – Extract filename from a full path
Over the years extracting the filename from a full path has always been a pain for me. Working with C#, I discovered a one line, easy to use, solution.
FileName = FileName.Split('\\')[FileName.Split('\\').Count() - 1];
Filename = “c:\TextFile.txt”
Will return:
“TextFile.txt”
@nosajhpled
nosajhpled / Two ways to fake a SQL table [SQL]
Created August 31, 2018 20:27
Two ways to fake a SQL table [SQL]
The first way is to create a temporary table and insert values into it.
DECLARE @declareTable TABLE (seq int, name VARCHAR(5) ) ;
INSERT INTO @declareTable (seq,name) values
(1,'one'),
(2,'two'),
(3,'three')
select * from @declareTable as dt;
@nosajhpled
nosajhpled / Getting CPU information from the command line [Windows]
Created August 31, 2018 20:29
Getting CPU information from the command line [Windows]
Here is an easy way to get CPU information from the command line:
wmic cpu get /format:list
Below is examples of some of the information provided from the command:
Description
L2 Cache
L3 Cache
Max Clock Speed
@nosajhpled
nosajhpled / Convert FoxPro to Microsoft SQL Server
Created August 31, 2018 20:29
Convert FoxPro to Microsoft SQL Server
The easiest way to convert FoxPro to Microsoft SQL Server is to copy the FoxPro file to a CSV and use the SQL Server Import and Export Wizard.
In FoxPro
use NameOfFile (or ?)
copy to NameOfFile type csv
This will give you a clean CSV with a header line.
@nosajhpled
nosajhpled / default.html
Last active January 9, 2019 15:15
Default HTML Code Template
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="" content="">
<!-- CSS -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="" content="">
<title>Tabulator Template</title>
Controller with all resources:
php artisan make:controller {ControllerName} --resource
Controller / Model / Migration
php artisan make:model {ModelName} -crm
Seed
php artisan make:seeder {ModelName}Seeder
Run Seed: