Skip to content

Instantly share code, notes, and snippets.

View BryantAvey's full-sized avatar

Bryant Avey BryantAvey

View GitHub Profile
@BryantAvey
BryantAvey / MakehumanUE4BoneFix.py
Created July 6, 2018 12:39 — forked from Bioblaze/MakehumanUE4BoneFix.py
This is a Fix for Makehuman to UE4 Skeleton Reassignment When you import a avatar from Makehuman, normally you`ll retarget the UE4 Skeleton to Match. When you do that, as you import animations from the UE4 Skeleton it changes them slightly, joints are out of line, bones are resized. This fixes that, bring them into Blender, and run this script. …
import bpy
bl_info = {
"name": "Fix Makehuman UE4 Animation",
"description": "Goes through and fixes all the Scale and Location of all Bones other then Root.",
"author": "Bioblaze Payne",
"version": (0,1),
"location": "View3D > Pose Mode > Unreal Engine",
"category": "Animation"
}
@BryantAvey
BryantAvey / CreateArticleCategoryGraphFromBlog.cypher
Last active May 14, 2021 17:23
Neo4j Cypher - Generate Blog Article and Category with Relationships From any Blog Feed
CALL apoc.load.xml("https://www.starwars.com/news/feed", "rss/channel/item")
YIELD value
WITH [child in value._children WHERE child._type = "title" | child._text][0] AS title,
[child in value._children WHERE child._type = "link" | child._text][0] AS guid,
apoc.text.regreplace(
[child in value._children WHERE child._type = "description" | child._text][0],
'<[^>]*>',
' '
) AS body,
[child in value._children WHERE child._type = "category" | child._text] AS categories
@BryantAvey
BryantAvey / Neo4jNodesTemplate.pq
Last active May 17, 2021 21:03
Import Neo4j Nodes Data to Power BI. This power query uses the default HTTP API to get nodes only data from Neo4j.
// This Power Query script connects to Neo4j and runs a Cypher query that returns node objects.
// Get Nodes
let
//Enter the base URL for the Neo4j Server
__Neo4jURL = "http://localhost:7474",
// Enter the name of the database in Neo4j
__Neo4jDatabase = "blogs",
// Enter the username for database access in the Neo4j database
__Username = "neo4j",
// Enter the user password for databases in the Neo4j database
@BryantAvey
BryantAvey / Neo4jPropertiesTemplate.pq
Last active May 17, 2021 21:03
Import Neo4j to Power BI using a named property Cypher query. This uses the default HTTP API with Neo4j.
// This Power Query connects to Neo4j returning data from a Cypher query that returns named properties id(n), n.name, etc.
// Get Properties and Column Names
let
//Enter the base URL for the Neo4j Server
__Neo4jURL = "http://localhost:7474",
// Enter the name of the database in Neo4j
__Neo4jDatabase = "blogs",
// Enter the username for database access in the Neo4j database
__Username = "neo4j",
// Enter the user password for databases in the Neo4j database
@BryantAvey
BryantAvey / Neo4jJoltPropertiesTemplate.pq
Last active March 29, 2023 09:22
Power Query to import Neo4j data using named properties in a Cypher query. Uses the Jolt HTTP API header setting.
//Use Neo4j's jolt formating with the HTTP API to get properties
//This Power Query uses Accept Header "application/vnd.neo4j.jolt" in the API Call, which makes for a cleaner and shorter PQ query
let
//Enter the base URL for the Neo4j Server
__Neo4jURL = "http://localhost:7474",
// Enter the name of the database in Neo4j
__Neo4jDatabase = "blogs",
// Enter the username for database access in the Neo4j database
__Username = "neo4j",
@BryantAvey
BryantAvey / TDA_Token_Code_Generation_Link
Last active April 24, 2022 20:25
TD Ameritrade Token Code Generation Link
@BryantAvey
BryantAvey / TDA_Generate_Refresh_Token_with_Cypher
Last active April 24, 2022 20:25
TD Ameritrade API with Neo4j: Generate a new refresh token using token code
// Generate New Refresh Token
CALL apoc.load.jsonParams("https://api.tdameritrade.com/v1/oauth2/token",null,"grant_type=authorization_code&refresh_token=&access_type=offline&code=" + "Paste_Your_CODE_Here" + "&client_id=YOUR_CONSUMER_KEY_GOES_HERE %40AMER.OAUTHAP&redirect_uri=YOUR_CALLBACK_URL_GOES_HERE")
YIELD value
UNWIND value.refresh_token as refresh_token_90days
//UNWIND value.access_token as access_token_30m
RETURN refresh_token_90days //, access_token_30m
@BryantAvey
BryantAvey / TDA_Cypher_Create_Param_Access_Token
Last active April 24, 2022 20:25
TD Ameritrade API with Neo4j: Cypher to create a parameter for a reusable Access Token
// Parameterize the access bearer token
:param token => {CALL apoc.load.jsonParams("https://api.tdameritrade.com/v1/oauth2/token",null,"client_id=YOUR_CONSUMER_KEY_GOES_HERE%40AMER.OAUTHAP&grant_type=refresh_token&refresh_token=" + apoc.text.urlencode("YOUR_90_DAY_REFRESH_TOKEN_GOES_HERE_FROM_PREVIOUS_STEP"))
YIELD value
RETURN "Bearer " + value.access_token as access_token}
@BryantAvey
BryantAvey / TDA_Cypher_Load_Instrument_Fundamental_Data
Last active April 24, 2022 20:25
TD Ameritrade API with Neo4j: Cypher to Load Instrument nodes with fundamental data
// Load instrument and fundamental
CALL apoc.periodic.iterate("UNWIND ['MSFT','SPY','TSLA','AAPL','QQQ','NFLX','NVDA'] AS Symbol RETURN Symbol"
,"CALL apoc.load.jsonParams('https://api.tdameritrade.com/v1/instruments?apikey='+ 'YOUR_CONSUMER_KEY_GOES_HERE' +'&symbol=' + Symbol + '&projection=fundamental',{Authorization:'$token[0].access_token' },null)
YIELD value
UNWIND value[Symbol] AS instrument
UNWIND instrument.fundamental as fundamental
MERGE (i:Instrument {symbol:instrument.symbol})
SET
i.cusip=instrument.cusip,
i.description=instrument.description,
@BryantAvey
BryantAvey / TDA_Cypher_Load_Daily_Price_History_for_all_Instruments
Last active April 24, 2022 20:24
TD Ameritrade API with Neo4j: Cypher to load daily price history for each Instrument node
//Load Daily Price History for every Instrument
CALL apoc.periodic.iterate("MATCH (i:Instrument) RETURN i.symbol as Symbol"
, "CALL apoc.load.jsonParams('https://api.tdameritrade.com/v1/marketdata/'+ Symbol + '/pricehistory?apikey=' + 'YOUR_CONSUMER_KEY_GOES_HERE' + '&frequencyType=daily&periodType=year&frequency=1&endDate=' + timestamp() + '&startDate=' + dateTime('2022-04-01').epochMillis , {Authorization:" + '\''+$token[0].access_token+'\'' + "} ,null)
YIELD value
UNWIND value.candles AS cndl
FOREACH (candle in cndl | MERGE (s:Price {ticker: value.symbol,timestamp: datetime.fromepochmillis(candle.datetime) })
ON CREATE SET
s.open = candle.open,
s.close = candle.close,
s.volume = candle.volume,