Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / myscript.sh
Last active Jul 27, 2021
Basic Shell Scripting
View myscript.sh
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@bradtraversy
bradtraversy / ssh.md
Last active Jul 27, 2021
SSH & DevOps Crash Course Snippets
View ssh.md

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@bradtraversy
bradtraversy / blogscraping.py
Created Jul 29, 2018
Simple scraping of a blog
View blogscraping.py
import requests
from bs4 import BeautifulSoup
from csv import writer
response = requests.get('http://codedemos.com/sampleblog/')
soup = BeautifulSoup(response.text, 'html.parser')
posts = soup.find_all(class_='post-preview')
@tracend
tracend / .handlebars.operators.md
Last active Jun 24, 2021
Handlebars relational operators #handlebars #helper #cc
View .handlebars.operators.md

Handlebars relational operators

This is a series of MATLAB style relational operators for Handlebars.

Operators

  • eq - equal to
  • ne - not equal to
  • lt - less than
  • gt - greater than
@bradtraversy
bradtraversy / sw_cached_pages.js
Created Aug 2, 2018
Service worker to cache pages
View sw_cached_pages.js
const cacheName = 'v1';
const cacheAssets = [
'index.html',
'about.html',
'/css/style.css',
'/js/main.js'
];
// Call Install Event
@bradtraversy
bradtraversy / sw_cached_site.js
Created Aug 2, 2018
Service Worker To Cache Response
View sw_cached_site.js
const cacheName = 'v2';
// Call Install Event
self.addEventListener('install', e => {
console.log('Service Worker: Installed');
});
// Call Activate Event
self.addEventListener('activate', e => {
console.log('Service Worker: Activated');
@rxaviers
rxaviers / gist:7360908
Last active Jul 27, 2021
Complete list of github markdown emoji markup
View gist:7360908

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@bradtraversy
bradtraversy / node_cheerio_scraping.js
Created Aug 6, 2018
Simple example to scrape some posts and put into a CSV file using Node & Cheerio
View node_cheerio_scraping.js
const request = require('request');
const cheerio = require('cheerio');
const fs = require('fs');
const writeStream = fs.createWriteStream('post.csv');
// Write Headers
writeStream.write(`Title,Link,Date \n`);
request('http://codedemos.com/sampleblog', (error, response, html) => {
if (!error && response.statusCode == 200) {
@bradtraversy
bradtraversy / docker-help.md
Last active Jul 27, 2021
Docker Commands, Help & Tips
View docker-help.md

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info