Skip to content

Instantly share code, notes, and snippets.

View plasx's full-sized avatar
🧭
👁️

Daniel Plas Rivera plasx

🧭
👁️
View GitHub Profile
@plasx
plasx / gist:397d7833f556f96007d1
Created November 28, 2015 22:15
php curl work
function getUserID($userName){
$url = 'https://api.instagram.com/v1/users/search?q='. $userName . '&client_id=' .clientID;
$instagramInfo = connectToInstagram($url);
$results = json_decode($instagramInfo, true);
//return $results['data'][0]['id';]
return $results['data'][0]['id'];
}
function printImages($userID){
import sqlite3
from flask import Flask, render_template
app = Flask(__name__)
conn = sqlite3.connect('example.db')
c = conn.cursor()
c.execute("SELECT * FROM emails")
conn.commit()
@app.route("/")
import sqlite3
from flask import Flask, render_template
app = Flask(__name__)
conn = sqlite3.connect('example.db')
c = conn.cursor()
c.execute('''CREATE TABLE emails
(name text, email text)''')
c.execute("INSERT INTO emails VALUES ('melinda gates', 'bill@microsoft.com')")
@plasx
plasx / instantclientguide.md
Last active December 12, 2018 03:15
Installing instant client 12 on macOS Sierra
@plasx
plasx / linkedin.py
Created March 31, 2017 01:29
linkedin login bs4
import requests
from bs4 import BeautifulSoup
client = requests.Session()
HOMEPAGE_URL = 'https://www.linkedin.com?allowUnsupportedBrowser=true'
LOGIN_URL = 'https://www.linkedin.com/uas/login-submit?allowUnsupportedBrowser=true'
html = client.get(HOMEPAGE_URL).content
soup = BeautifulSoup(html)
@plasx
plasx / AzureCheatSheet.md
Last active May 24, 2022 05:47
Azure Cheat Sheet

Listing Images via Azure CLI

az vm image list --output table

Deleting certain resoruces in a resource group

List resource groups in a subscription

az resource list

Create it

New-AzureRmKeyVault -VaultName vaultofdaniel -ResourceGroupName myResourceGroup -Location eastus -EnabledForDeployment -EnabledForTemplateDeployment

which would look like this

az keyvault create --resource-group myResourceGroup --name danielvault

find objectid from serviceprinsiple

az ad sp show --id

@plasx
plasx / Azure2TerraformTranslation.md
Last active September 13, 2017 14:51
Azure To Terraform Translation

Creating Tags

Azure

--tags "createdby=Daniel Plas Rivera" "year=2019"

Terraform

  tags {
    createddate = "${var.created_date}"
    editeddate = "${timestamp()}"
    createdby = "${var.created_by}"

environment = "${var.environment}"

@plasx
plasx / instantclientguide.md
Created May 23, 2018 03:23 — forked from addodelgrossi/instantclientguide.md
Installing instant client 12 on macOS Sierra

Installing Oracle Mac OS Sierra

Download

  • instantclient-basic-macos.x64-12.2.0.1.0.zip
  • instantclient-sqlplus-macos.x64-12.2.0.1.0.zip
  • instantclient-sdk-macos.x64-12.2.0.1.0.zip

Create a directory /usr/local/lib/share/oracle

@plasx
plasx / python37cheatsheet.md
Last active July 27, 2018 20:52
Daniel's Python 3.7 Cheat sheet

Looping with index

Enumerate

Great for maintaining the index in the loop, as "for i in somelist: " does not maintain the index

items = ['dog','fog', 'jump', 'joma']
for i, item in enumerate(items):
    print(i, item)
0 dog
1 fog

2 jump