Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# oh my ZSH
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
"""
Using the Energy Information Administration API, I created a social network graph in Python of oil-producing countries based on high correlations between production decisions. I used advanced code to customize label placement and margins.
Libraries: Numpy, Pandas, EIA, NetworkX, Matplotlib
"""
#pip install EIA-python
#pip install networkx
import numpy as np
/*
*********************************************************************
http://www.mysqltutorial.org
*********************************************************************
Name: MySQL Sample Database classicmodels
Link: http://www.mysqltutorial.org/mysql-sample-database.aspx
Version 3.1
+ changed data type from DOUBLE to DECIMAL for amount columns
Version 3.0
+ changed DATETIME to DATE for some colunmns
Raq7IMZ4QkqK2Oj7lKT3bxJTgwxeJFYx4ADjTqVKdQY=
@anoldwebsite
anoldwebsite / rock-paper-scissors.py
Last active May 26, 2022 18:11
Rock Paper Scissors game to practice if elif else and functions in Python
import random
def summarize(computer_wins, draw_games, user_wins):
total_games = user_wins + computer_wins + draw_games
if total_games > 0:
user = user_wins / total_games * 100
computer = computer_wins / total_games * 100
draw = draw_games / total_games * 100
print("You won: ", "{:.2f}".format(user), "%.")
@anoldwebsite
anoldwebsite / dataInArray1.js
Created April 16, 2022 10:04
Create array with some data
const dataset = Array.from(
{ length: 10 },
(d, index) => (index + 1) * 10
);
console.log(dataset);//[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
@anoldwebsite
anoldwebsite / Open the home page by hitting the root end point using Express server
Created January 6, 2022 10:53
Open the home page by hitting the root end point in Node.js app using Express server
require('dotenv').config();
const express = require('express');
const app = express();
const listener = app.listen(process.env.PORT || 3000, () => {
console.log('Your app is listening on port ' + listener.address().port)
});
//Open the homepage if the root of the project is asked for by the client.
app.use(express.static('public'))
app.get('/', (req, res) => {
@anoldwebsite
anoldwebsite / expressServer.js
Created January 5, 2022 14:06
Creating Express server and starting in 3 lines of NodJS
//npm install express --save
const express = require('express');
const app = express();
const listener = app.listen(process.env.PORT || 3000, () => {
console.log('Your app is listening on port ' + listener.address().port);
});
@anoldwebsite
anoldwebsite / App.js
Last active May 29, 2021 03:26
In the footer.js file we have made a basic footer which can be refined by for exmaple using a Grid Component for responsive layout
import React from 'react';
import { ThemeProvider } from '@material-ui/styles'
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import Header from '../components/ui/header';
import Footer from '../components/ui/footer';
import theme from './ui/theme';
function App() {
return (
<ThemeProvider theme={theme}>
@anoldwebsite
anoldwebsite / user.js
Created July 4, 2020 12:44
SpaceX complete project NodeJS React part 4 hooked up our data sources to Apollo server
const { DataSource } = require('apollo-datasource');
const isEmail = require('isemail');
class UserAPI extends DataSource {
constructor({ store }) {
super();
this.store = store;
}
/**