Skip to content

Instantly share code, notes, and snippets.

View rvvvt's full-sized avatar
💭
hail, traveler.

rvvvt rvvvt

💭
hail, traveler.
View GitHub Profile
@marcosnakamine
marcosnakamine / index.php
Created March 22, 2017 20:44
WooCommerce - Google Merchant xml feed generator
<?php header( 'Content-type: text/xml' ) ?>
<?php echo '<?xml version="1.0"?>' ?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
<channel>
<title><?php echo bloginfo( 'name' ) ?></title>
<link><?php echo home_url() ?></link>
<description><?php echo bloginfo( 'description' ) ?></description>
<?php
$query = new WP_Query( array(
@jberndsen
jberndsen / promise.js
Last active August 7, 2019 04:56
exercises to learn promises
// BEFORE YOU start
// npm init -y
// npm install --save node-fetch
const fetch = require('node-fetch');
// INTRO
// Javascript is single threaded, meaning that two bits of script cannot run at the same time.
// Doing something which takes some time (a costly algorithm, a back-end call) causes everything else to halt
// until it completes. In browsers, this often means the UI becomes non-responsive,
// because the rendering of the screen is blocked.
@yxlao
yxlao / google_search_bs.py
Last active January 18, 2019 15:54
Google search with BeautifulSoup
import requests
from bs4 import BeautifulSoup
search_url_prefix = "https://www.google.com/search?q="
def get_first_result(search_str):
search_url = search_url_prefix + search_str
r = requests.get(search_url)
soup = BeautifulSoup(r.text, "html.parser")
return soup.find('cite').text
@Kf4btg
Kf4btg / pyqt5_app_template.py
Last active February 10, 2019 04:42
Decent starting point for pretty much any simple PyQt5 application
#!/usr/bin/env python3
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QAction
from PyQt5.QtGui import QIcon, QKeySequence
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
@maksii
maksii / linkedin auto-inviter
Last active December 19, 2020 16:54
Script to automatically add connections from "People You May Know" page
var inviter = {} || inviter;
inviter.userList = [];
inviter.className = 'button-secondary-small';
inviter.refresh = function () {
window.scrollTo(0, document.body.scrollHeight);
window.scrollTo(document.body.scrollHeight, 0);
window.scrollTo(0, document.body.scrollHeight);
};
@vinovator
vinovator / XKCDDownloader.py
Last active June 10, 2018 06:19
Download all XKCD comics - incomplete
# Python 3
# XKCDDownloader.py
########################################################################################################################
# Algorithm
# 1) Open the latest page of XKCD
# 2) Download the image, title and alternate text from the page and save the images in specified folder
# 3) Build a html file which contains the alt, title and src in a html file
# 4) If any error in download skip the page
# 5) Find the previous page url from current page and repeat steps 2, 3 & 4
# 6) Continue until you find the very 1st comic
@elliotbonneville
elliotbonneville / topkeywords.js
Last active April 5, 2025 00:41
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@aarondai
aarondai / deferred.js
Created July 18, 2014 21:17
NodeJS:Multiple Async Operations
// Module Dependencies
var Q = require('q'),
request = require('request');
// Some URLs to play with, and a queue to keep the code readable
var urls = ['google.com', 'twitter.com', 'facebook.com'],
queue = [];
// A standard NodeJS function: a parameter and a callback; the callback
// will return error (if any) as first parameter and result as second
@Supermathie
Supermathie / parseCSV.py
Created April 14, 2014 20:50
python CSV example
#!/usr/bin/env python
import csv
import sys
from pprint import pprint
csvreader = csv.reader(sys.stdin)
# Read the header line and extract the column names
header = csvreader.next()
@JamieMason
JamieMason / unfollow.js.md
Last active May 8, 2025 20:30
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

By @foldleft.bsky.social, see also Unfollow everyone on bsky.app.

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)