Skip to content

Instantly share code, notes, and snippets.

// http://stackoverflow.com/questions/967815/how-do-you-fade-in-out-a-background-color-using-jquery
//Color row background in HSL space (easier to manipulate fading)
$('tr').eq(1).css('backgroundColor','hsl(0,100%,50%');
var d = 1000;
for(var i=50; i<=100; i=i+0.1){ //i represents the lightness
d += 10;
(function(ii,dd){
setTimeout(function(){
$('tr').eq(1).css('backgroundColor','hsl(0,100%,'+ii+'%)');
############################################################################################
# This script creates Anki decks from a web application.
# DrLulz Mar-2016
############################################################################################
class IM:
import os, sys, wget, ntpath, unicodedata, codecs, linecache, time
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
@DrLulz
DrLulz / gist:660f8f2c5f0712d0462d
Created March 10, 2016 23:21 — forked from casschin/gist:1990245
Python webdriver api quick sheet
### Locating UI elements ###
# By ID
<div id="coolestWidgetEvah">...</div>
element = driver.find_element_by_id("coolestWidgetEvah")
or
from selenium.webdriver.common.by import By
element = driver.find_element(by=By.ID, value="coolestWidgetEvah")
# By class name:
############################################################################################
# This script creates Anki decks from a web application.
# Designed specifically for usmle-rx.com flashfacts, but can be modified for any scenerio.
#
# Automation provided by /u/SYMPATHETIC_GANG_LION
# Anki import provided by /u/DrLulz
############################################################################################
import os
import sys
@DrLulz
DrLulz / mpv-bookmarks.lua
Last active June 9, 2022 11:57
Creates .edl file for MPV player used here as a bookmarked playlist. Binds "x" so that first press is start of "bookmark" and second press is end of "bookmark." The file produced can then be played using "mpv --playlist=file.edl".
function file_exists(playlist)
local f=io.open(playlist, "r")
if f~=nil then io.close(f) return true else return false end
end
function entry_complete(playlist)
local f=io.open(playlist, "r")
chars = f:read("*all")
last_char = string.sub(chars, -1)
if last_char == ";" then io.close(f) return true else return false end
@DrLulz
DrLulz / mpv-commands.lua
Created June 1, 2015 14:48
MPV zoom, rotate, and pan. Add to mpv scripts folder.
-- ZOOM
function zoom_in()
zoom = mp.get_property("video-zoom")
zoom_to = zoom + 0.1
mp.set_property("video-zoom", zoom_to)
end
function zoom_out()
zoom = mp.get_property("video-zoom")
zoom_to = zoom - 0.1
mp.set_property("video-zoom", zoom_to)
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import re
import os
import csv
import sys
import glob
import string
import linecache
# -*- coding: utf-8 -*-
import re
import os
import csv
import glob
import string
from Tkinter import Tk
import unicodedata as udata
from cStringIO import StringIO
@DrLulz
DrLulz / raymond-4.0.py
Last active November 15, 2015 13:03
Script should be run from terminal with argument. If the .py and the .csv are in the same directory the argument can be the filename itself (eg $ python raymond-4.0.py filename.csv), else if the .py and .csv are in different directories the argument must be the absolute path to the .csv (eg $ python raymond-4.0.py "/Users/raymond/Desktop/filenam…
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import re
import os
import csv
import sys
import glob
import string
import linecache
-- cards are what you review. easy!
CREATE TABLE cards (
id integer primary key,
-- the epoch milliseconds of when the card was created
nid integer not null,
-- notes.id
did integer not null,
-- deck id (available in col table)
ord integer not null,
-- ordinal, seems like. for when a model has multiple templates, or thereabouts