In Less Than 100 Lines of Python Code
Dr. Yves J. Hilpisch | The Python Quants GmbH
Online, February 2021
(short link to this Gist: http://bit.ly/algo_100_code)
| """ To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory | |
| git clone https://github.com/myshell-ai/OpenVoice | |
| cd OpenVoice | |
| git clone https://huggingface.co/myshell-ai/OpenVoice | |
| cp -r OpenVoice/* . | |
| pip install whisper pynput pyaudio | |
| """ | |
| from openai import OpenAI | |
| import time |
In Less Than 100 Lines of Python Code
Dr. Yves J. Hilpisch | The Python Quants GmbH
Online, February 2021
(short link to this Gist: http://bit.ly/algo_100_code)
| def get_headers(s, sep=': ', strip_cookie=True,strip_cl=True, strip_headers:list=[]) -> dict(): | |
| l = s.split('\n') | |
| d = dict() | |
| for kv in l: | |
| if kv: | |
| k = kv.split(sep)[0] | |
| v = kv.split(sep)[1] | |
| if strip_cookie and k == 'cookie': continue | |
| if strip_cl and k == 'content-length': continue | |
| if k in strip_headers: continue |
| import requests | |
| import time | |
| import json | |
| headers = {'User-Agent': 'android:subgrowth:v0.1 (by /u/twelvis)'} | |
| def getit(subreddit): | |
| r = requests.get( | |
| 'http://www.reddit.com/r/' + |
| require 'yaml' | |
| task :deploy do | |
| # add check if file exists etc | |
| keys = YAML::load(File.open('keys.yml')) | |
| token = keys['token'] | |
| secret = keys['secret'] | |
| # add check for empty values etc |
| {% comment %} | |
| To add a companion product to the cart automatically if a primary product is in cart: | |
| 1. Create a new link list under your Navigation tab. | |
| 2. In that link list, make the first link point to companion product. | |
| 3. Copy your link list handle where indicated at line 9 | |
| 4. Set the minimum cart total required for the bonus product on line 10 | |
| {% endcomment %} | |
| {% assign linklist = linklists['put-your-link-list-handle-here'] %} | |
| {% assign min_total = 100 %} |
| import scrapy | |
| from scrapy.contrib.spiders import CrawlSpider, Rule | |
| from scrapy.contrib.linkextractors.lxmlhtml import LxmlLinkExtractor | |
| from buzzLinks.items import BuzzlinksItem | |
| from urlparse import urlparse | |
| # Spider | |
| class DmozSpider(CrawlSpider): | |
| name = "buzzfeedNews" | |
| allowed_domains = ["buzzfeed.com"] |
| #!/bin/bash -ex | |
| # | |
| # configures wordpress file permissions based on recommendations | |
| # from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
| # | |
| # script is aware of .git directories by default. edit if you need to consider | |
| # other folders as well. | |
| # | |
| # you will find a log file in /tmp/ in case you fucked up. |
| {% comment %} | |
| To add a companion product to the cart automatically if a primary product is in cart: | |
| 1. Create a new link list under your Navigation tab. | |
| 2. In that link list, make the first link point to companion product. | |
| 3. Copy your link list handle where indicated at line 8: | |
| {% endcomment %} | |
| {% assign linklist = linklists['put-your-link-list-handle-here'] %} | |
| {% comment %} |