Skip to content

Instantly share code, notes, and snippets.

@TApicella
TApicella / mount_fade_out.user.js
Created October 7, 2014 07:44
Mount fade out for HabitRPG
// ==UserScript==
// Sources: http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
// @name Mount Fader
// @namespace habitRPGMountFader
// @include https://habitrpg.com/*
// @author Tom Apicella (jquery by Erik Vergobbi Vold & Tyler G. Hicks-Wright)
// @description This userscript fades out your mount when you mouse over your hero
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading

Keybase proof

I hereby claim:

  • I am tapicella on github.
  • I am tapicell (https://keybase.io/tapicell) on keybase.
  • I have a public key whose fingerprint is 0196 9E4D 82DE FBAF EBA4 84D3 0B83 5ECF 5ED5 27D0

To claim this, I am signing this object:

@TApicella
TApicella / emoji_down.py
Created December 2, 2015 15:58
A way to download all emoji from a slack team
""" This script bulk downloads emoji from a slack channel """
import os, time, urllib
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
display = Display(visible=0, size=(800, 600))
display.start()
driver = webdriver.Chrome("DRIVER LOCATION")
""" This script bulk uploads emoji to a slack channel """
import os, time
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
rootdir = 'EMOJI SOURCE'
display = Display(visible=0, size=(800, 600))
display.start()
@TApicella
TApicella / watermark.py
Last active July 23, 2016 01:45
A script that adds a watermark to the bottom right of each picture in a directory of pictures
from PIL import Image, ImageDraw
import os, math
#SETTINGS
WIDTH_RATIO = 3 #Ratio of image min width to watermark width
MIN_WIDTH = 200 #Minimum width of watermark. In my watermark, it is 1/3 of the normal width
MIN_HEIGHT = 40 #Minimum height of watermark. In my watermark ,it is 1/3 of the normal height
WATERMARK_LOCATION = "watermark.png"
#Most helpful source: http://stackoverflow.com/questions/13662184/python-pil-lighten-transparent-image-and-paste-to-another-one
@TApicella
TApicella / HmSh-10.py
Last active May 8, 2017 15:09
Philly Daily Programmer: 5-8-2016
'''
Given a sorted list of distinct integers, write a function that returns whether there are two integers in the list that add up to 0. For example, you would return true if both -14435 and 14435 are in the list, because -14435 + 14435 = 0. Also return true if 0 appears in the list.
[1, 2, 3] -> false
[-5, -3, -1, 2, 4, 6] -> false
https://repl.it/HmSh/10
'''
test1 = [] #False
@TApicella
TApicella / Hmhz-18.py
Last active May 8, 2017 18:12
RosettaCode: Sum to 100
'''
rosettacode.org/wiki/Sum_to_100
brute force solution
https://repl.it/Hmhz/20
'''
# http://stackoverflow.com/questions/34559663/convert-decimal-to-ternarybase3-in-python
def decimalToTernary (n):
if n == 0:
return '0'
@TApicella
TApicella / RosettaCode Rep-string.py
Created May 8, 2017 20:09
RosettaCode Rep-string created by tapicella - https://repl.it/Hmz8/30
'''
rosettacode.org/wiki/Rep-string
Given a series of ones and zeroes in a string, define a repeated string or rep-string as a string which is created by repeating a substring of the first N characters of the string truncated on the right to the length of the input string, and in which the substring appears repeated at least twice in the original.
For example, the string 10011001100 is a rep-string as the leftmost four characters of 1001 are repeated three times and truncated on the right to give the original string.
Note that the requirement for having the repeat occur two or more times means that the repeating unit is never longer than half the length of the input string.
10011 10011
@TApicella
TApicella / RosettaCode_validateISIN.py
Created May 8, 2017 21:11
RosettaCode_validateISIN created by tapicella - https://repl.it/HnEm/27
'''
An International Securities Identification Number (ISIN) is a unique international identifier for a financial security such as a stock or bond.
Replace letters with digits, by converting each character from base 36 to base 10, e.g. AU0000XVGZA3 →1030000033311635103.
Perform the Luhn test on this base-10 number.
US0378331005:TRUE
US0373831005:FALSE
U50378331005:FALSE
AU0000XVGZA3:TRUE
@TApicella
TApicella / Daily Programmer: 5-9-2017.py
Last active May 9, 2017 15:27
Daily Programmer: 5-9-2017 created by tapicella - https://repl.it/Hoet/27
'''
Following up on yesterday... Given a sorted list of distinct integers, write a function that returns whether there *any subset combinations* in the list that add up to 0. For example, you would return true if `[-8, 3, 5, 11]` are in the list, because -8 + 3 + 5 = 0. Also return true if 0 appears in the list.
'''
from itertools import combinations
def findSubset(mylist):
if len(mylist)==0: return False
elif len(mylist)==1: return(mylist[0]==0)
else: