Skip to content

Instantly share code, notes, and snippets.

@ianb
ianb / voice.tsx
Created January 9, 2025 19:42
An example of using @ricky0123/vad-react with buffered audio/transcription
// Note: this isn't complete, but is an extraction of most of the relevants bits of a working module
import { useMicVAD, utils } from "@ricky0123/vad-react";
const FLUSH_AFTER_SPEECH_LENGTH = 20000; // transcribe after the first break after 20 seconds
const SILENCE_LENGTH = 2000; // transcribe after 2 seconds of non-speech
export function LiveVoiceWidget({
onTranscript,
@tomhicks
tomhicks / plink-plonk.js
Last active November 12, 2024 19:08
Listen to your web pages
@sahava
sahava / allowlinker-ga.js
Last active December 29, 2023 09:11
This script reproduces Google Analytics' allowLinker plugin, resulting in a function that returns true if the linker parameter in the URL is valid and false otherwise. Uses the "old" linker plugin format. You can also pass a string as an argument to check if that string is a valid linker parameter.
var checkLinker = function(str) {
// First browser fingerprint method.
// Uses the clientId / gid string, user agent, time, and browser plugin descriptions.
var joiner = function (cidGid, offset) {
var a = new Date,
b = window.navigator,
c = b.plugins || [];
var d = [cidGid, b.userAgent, a.getTimezoneOffset(), a.getYear(), a.getDate(), a.getHours(), a.getMinutes() + offset];
for (var e = 0; e < c.length; ++e) {
@cameroncowden
cameroncowden / page.google-product-feed.liquid
Created August 15, 2018 15:34
Shopify Google Product Feed xml generator
{% comment %}
Instructions:
- Create a blank page called 'Google Base Product Feed'and save it
- Open that page for editing and select 'page.google-feed' from the page template selector
- Add a brief site description to the meta-shop-description snippet
- The feed url should now be available at http://www.yoursite.com/pages/google-base-product-feed
- validate your field at http://validator.w3.org/feed/
- when ready, submit your feed at http://base.google.com
@grantstephens
grantstephens / Flashing OpenWRT.md
Last active November 5, 2023 10:21
TP-Link TL-WR902AC v3 OpenWRT Setup

Important Links:

Flash instruction:

The only way to flash LEDE image in TL-WR902AC v3 is to use tftp recovery mode in U-Boot:

  1. Configure PC with static IP 192.168.0.66/24 and tftp server.
  2. Rename "openwrt-ramips-mt76x8-tplink_tl-wr902ac-v3-squashfs-tftp-recovery.bin" to "tp_recovery.bin" and place it in tftp server directory.
@BrainlabsDigital
BrainlabsDigital / Domain Name Checker.js
Created April 3, 2018 09:44
Script to find if any ads or keywords have landing pages with the wrong domain.
/**
*
* Domain Name Checker
*
* This script will scan through your keyword and ad URLs, checking the domain
* names for anything out of place, and output any discrepancies it finds into a
* Google Sheet.
*
* Version: 1.0
* Google AdWords Script maintained on brainlabsdigital.com
/* Put Google Ads Data in Google Spreadsheet
* -----------------------------------------
*
* Script by Optmyzr.com
*
* v3 (20190702)
* - updated to API v201809
* v2 (20180810)
* - updated to newer reporting version in ads API
*
@BrainlabsDigital
BrainlabsDigital / Copy Labels Between Keywords and Ads.js
Created December 15, 2017 17:52
Copies labels from ads to keywords in the same ad group, or from keywords to ads.
/**
* Copying Labels From Keywords To Ads Or Vice-Versa
*
* If a certain percentage of keywords (or ads) are labelled with a particular
* label within an ad group, the script applies the label to all ads (or
* keywords) in that ad group.
*
* Version: 1.0
* Google AdWords Script maintained on brainlabsdigital.com
*/
@mhawksey
mhawksey / face-detection-to-google-analytics.py
Last active January 16, 2020 21:40
Snippet of code used for DevFest London 2017 to count faces in audience and send to Google Analytics (see https://mashe.hawksey.info/?p=17787)
import io
import picamera
import cv2
import numpy
def hitGA(faces):
print("Sending to GA")
requests.get("http://www.google-analytics.com/collect?v=1" \
+ "&tid=YOUR_UA_TRACKING_ID_HERE" \
+ "&cid=1111" \
@feimosi
feimosi / persist-restore-form-data.js
Last active October 17, 2024 15:49 — forked from CezaryDanielNowak/gist:85302c1d3323e951e3885bcedaa7c10b
Persist / restore form data using localStorage
// Persist data:
localStorage._formData_ = JSON.stringify(Array.from(document.forms[0].querySelectorAll('input')).map((el) => el.value));
// Restore data:
_formData_ = JSON.parse(localStorage._formData_) || [];
Array.from(document.forms[0].querySelectorAll('input')).forEach((input, id) => {
input.value = _formData_[id];
var event = document.createEvent("HTMLEvents");
event.initEvent("input", true, true);
input.dispatchEvent(event);