Skip to content

Instantly share code, notes, and snippets.

View jdvp's full-sized avatar

JD Porterfield jdvp

View GitHub Profile
@jdvp
jdvp / comment-section.html
Last active September 28, 2021 00:54
For Mato. OUTDATED : See the file here instead: https://github.com/jdvp/jekyll-comments-google-forms
{% if site.comment-read %}
<!-- Our own JS starts here -->
<script>
/* Initial load of the comments section contnet. This ensures that we are only loading
JQuery and other scripts once we actually need them */
async function initialCommentLoad() {
/* Load JQuery */
var loadJquery = document.createElement("script");
loadJquery.type = "text/javascript";
loadJquery.src = "https://code.jquery.com/jquery-3.6.0.min.js";
@jdvp
jdvp / comment-section.html
Last active May 16, 2022 15:11
OUTDATED : See the file here instead: https://github.com/jdvp/jekyll-comments-google-forms Version of comment-section.html that allows for scripts to be loaded after the page loads. This ensures scripts aren't loaded for users when they aren't even going to view the comments
{% if site.comment-read %}
<!-- Our own JS starts here -->
<script>
/* Initial load of the comments section contnet. This ensures that we are only loading
JQuery and other scripts once we actually need them */
async function initialCommentLoad() {
/* Load JQuery */
var loadJquery = document.createElement("script");
loadJquery.type = "text/javascript";
loadJquery.src = "https://code.jquery.com/jquery-3.6.0.min.js";
@jdvp
jdvp / comment-section.html
Last active September 26, 2021 07:53
OUTDATED : See the file here instead: https://github.com/jdvp/jekyll-comments-google-forms Code required for adding a Google Forms-based commenting system to Jekyll blogs. Necessary for the https://jdvp.me/articles/Google-Forms-Jekyll-Comments article.
{% if site.comment-read %}
<!-- Load Required 3rd-Party Scripts. We use the following:
* jquery for DOM manipulation
* jquery-csv for parsing Google Sheets CSV data to JSON
* validator for escaping user-entered comments to prevent malicious code input in comments
Make sure to update these to the latest versions every once in a while.
-->
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
@jdvp
jdvp / auto-scrcpy.plist
Last active April 3, 2021 05:55
plist for the auto-scrcpy program (for https://jdvp.me/articles/Mirroring-with-AutoScrcpy)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/jdvp/Library/Android/sdk/tools:/Users/jdvp/Library/Android/sdk/tools/bin/:/Users/jdvp/Library/Android/sdk/platform-tools</string>
</dict>
<key>Label</key>
@jdvp
jdvp / auto-scrcpy.py
Last active May 31, 2024 17:19
Auto-mirroring Android devices with auto-scrcpy. https://jdvp.me/articles/Mirroring-with-AutoScrcpy
#!/usr/bin/python
import subprocess
#Command that runs when we don't have a specific command for a given device
DEFAULT_SCRCPY_COMMAND = "scrcpy --turn-screen-off --stay-awake"
#Custom scrcpy command that runs for given devices
CUSTOM_DEVICE_COMMANDS = {
"device1-serial" : "scrcpy --turn-screen-off --stay-awake --window-x 10 --window-y 10 --window-width 1400 --window-height 700",
"devices2-serial" : "scrcpy --turn-screen-off --stay-awake --window-x 10 --window-y 720 --window-width 1517 --window-height 700"
@jdvp
jdvp / ubee.py
Created January 25, 2019 02:10
Add blocked sites to router Uber DDW36C
from subprocess import call
import time
blockedSites = ["101com.com","101order.com","123found.com","123freeavatars.com","180hits.de","180searchassistant.com","207.net","247media.com","24log.com","24log.de","24pm-affiliation.com","2mdn.net","2o7.net","2znp09oa.com","33across.com","360yield.com","3lift.com","4affiliate.net","4d5.net","4info.com","4jnzhl0d0.com","50websads.com","518ad.com","51yes.com","5mcwl.pw","600z.com","6ldu6qa.com","777partner.com","77tracking.com","7bpeople.com","7f1au20glg.com","7search.com","82o9v830.com","99count.com","a-ads.com","a-counter.kiev.ua","a.aproductmsg.com","a.consumer.net","a.mktw.net","a.sakh.com","a.ucoz.net","a.ucoz.ru","a.xanga.com","a135.wftv.com","aaddzz.com","abacho.net","abackchain.com","abandonedaction.com","abandonedclover.com","abashedangle.com","abc-ads.com","aboardlevel.com","abruptroad.com","absentstream.com","absoluteclickscom.com","absorbingband.com","absurdwater.com","abz.com","ac.rnm.ca","acridtwist.com","actionsplash.com","actualdeals.com","actuallysheep
@jdvp
jdvp / Utils.java
Created August 2, 2017 21:47
RxJava Fibonacci Sequence
public class Utils {
public static Observable<Integer> fibonacci(int f1, int f2) {
return Observable.range(1, 1).
repeat().
scan(new ArrayList<>(Arrays.asList(f1, f2)),
(list, tick) -> {
list.add(list.get(list.size() - 2) + list.get(list.size() - 1));
list.remove(0); //or else this becomes pretty memory inefficient eventually, right?
return list;
@jdvp
jdvp / txt.txt
Created November 3, 2016 03:29
Clone -> Fork
1. Fork the repo that you cloned (on github)
we will refer to the url this is stored at later as {url}
i.e. {url} = https://github.com/{user}/{project}
2. Rename local origin
git remote rename origin upstream
3. Add your fork as the new origin
git remote add origin {url}
@jdvp
jdvp / chart.html
Last active September 12, 2024 02:33
Reference Line in Google Charts Timeline
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="chart.js"></script>
<div id="timeline" style="height: 240px;"></div>