Skip to content

Instantly share code, notes, and snippets.

View nealrs's full-sized avatar
💭
code monster

Neal Shyam nealrs

💭
code monster
View GitHub Profile
@ChrisJamesC
ChrisJamesC / Yo
Last active August 29, 2015 14:05
Utlimate Yo
#!/usr/bin/python
# This script first executes the command passed as argument, then, when the command
# is done, it sends you a yo
#
# All you need to do is define the YO_USER and YO_TOKEN environment variables with:
# YO_USER: your Yo username
# YO_TOKEN: the Yo API token corresponding to the Yo API account you want to receive
# Yos from, don't forget to subscribe to your accounts.
#
@panchr
panchr / stringFilter.py
Last active August 29, 2015 14:13
Python string filtering
import re
FILTER_WORDS = ["spam", "morespam", "blahblah"] # and so forth
FILTER = re.compile("|".join(FILTER_WORDS))
def phrasePassesFilter(word):
'''Checks if the phrase passes the filter'''
return not bool(FILTER.match(word)) # if there are no matches, FILTER.match --> None, so it passes the filter
@lcasartelli
lcasartelli / regex.js
Created October 23, 2013 14:30
Useful regexes
var email_regex = /^(?:[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9\-]*[a-zA-Z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/;
var uuid_regex = /^[0-9a-zA-Z\-]+$/;
var url_regex = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[.\!\/\\w]*))?)/;
var country_code_regex = /^\+{0,1}[0-9]{1,4}$/;
var phone_regex = /^[0-9\-().\s]{10,15}$/;
@davidensinger
davidensinger / summary-twitter-card-in-jekyll.html
Last active June 13, 2016 12:03
Support for the Summary Twitter Card in Jekyll
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@site_username">
<meta name="twitter:creator" content="@creator_username">
{% if page.title %}
<meta name="twitter:title" content="{{ page.title }}">
{% else %}
<meta name="twitter:title" content="{{ site.title }}">
{% endif %}
{% if page.url %}
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
@nealrs
nealrs / check.py
Last active December 15, 2016 02:58
supply a first, last, and domain name -- and this script will run through common email patterns to find valid email addresses. worried about domains with catchalls & missing mx records? yeah we got that covered. $ python check.py eric cartman southpark.com
#!/usr/bin/env python
# encoding: utf-8
# install dependencies: sudo pip install validate_email pyDNS
# run it: python check.py robin hood gmail.com
# FYI, forwarding addresses (not catchalls) will report 'probably not valid'. that's all i've got right now.
import sys
from validate_email import validate_email
@scturtle
scturtle / app.py
Created April 14, 2013 04:53
Flask login with google+ oauth
from flask import Flask, request, session, redirect, url_for
import urllib
import requests
app = Flask(__name__)
app.secret_key = 'iwonttellyou'
redirect_uri = 'http://localhost:5000/callback'
client_id = '' # get from https://code.google.com/apis/console
client_secret = ''
@garbados
garbados / gist:4514450
Last active May 30, 2017 01:28
A Python script providing access to FullContact's API. Requires Requests, and a FullContact API key. Run with `python -i` to make it a CLI. Or, check out `https://github.com/garbados/fullcontact.py` for a more robust interface.
import requests
import json
api_key = 'your_api_key'
url = "https://api.fullcontact.com/v2/person.json"
def whois(**kwargs):
if 'apiKey' not in kwargs:
kwargs['apiKey'] = api_key
r = requests.get(url, params=kwargs)
#!/bin/bash
set -e
# Send a private message to someone on slack
# from the command line.
# Print a usage message and exit.
usage(){
local name=$(basename "$0")
@zackbloom
zackbloom / gist:7774909
Created December 3, 2013 18:36
Bookmarklet to run sortable.js (http://github.hubspot.com/sortable/docs/welcome/) on every table on the page
javascript:(function()%7B(function()%7Bvar%20a%2Cb%2Cc%2Cd%2Ce%2Cf%3Ba%3D%22table%5Bdata-sortable%5D%22%2Cc%3D%2F%5E-%3F%5B%C2%A3%24%C2%A4%5D%3F%5B%5Cd%2C.%5D%2B%25%3F%24%2F%2Cf%3D%2F%5E%5Cs%2B%7C%5Cs%2B%24%2Fg%2Ce%3D%22ontouchstart%22in%20document.documentElement%2Cb%3De%3F%22touchstart%22%3A%22click%22%2Cd%3D%7Binit%3Afunction(b)%7Bvar%20c%2Ce%2Cf%2Cg%2Ch%3Bfor(null%3D%3Db%26%26(b%3D%7B%7D)%2Cnull%3D%3Db.selector%26%26(b.selector%3Da)%2Ce%3Ddocument.querySelectorAll(b.selector)%2Ch%3D%5B%5D%2Cf%3D0%2Cg%3De.length%3Bg%3Ef%3Bf%2B%2B)c%3De%5Bf%5D%2Ch.push(d.initTable(c))%3Breturn%20h%7D%2CinitTable%3Afunction(a)%7Bvar%20b%2Cc%2Ce%2Cf%2Cg%3Bif(1%3D%3D%3Da.tHead.rows.length%26%26%22true%22!%3D%3Da.getAttribute(%22data-sortable-initialized%22))%7Bfor(a.setAttribute(%22data-sortable-initialized%22%2C%22true%22)%2Ce%3Da.querySelectorAll(%22th%22)%2Cb%3Df%3D0%2Cg%3De.length%3Bg%3Ef%3Bb%3D%2B%2Bf)c%3De%5Bb%5D%2C%22false%22!%3D%3Dc.getAttribute(%22data-sortable%22)%26%26d.setupClickableTH(a%2Cc%2Cb)%3Breturn%20a%7D%7D
@huzairyworks
huzairyworks / tiny_letter_mod.php
Created August 9, 2011 13:58
TinyLetter embed code
<form action="http://tinyletter.com/mohdhuzairy" method="post" target="popupwindow" onsubmit="window.open('http://tinyletter.com/mohdhuzairy', 'popupwindow', 'scrollbars=yes,width=800,height=600');return true"><p><input type="text" name="emailaddress" value="Masukkan emel anda" onfocus="if (this.value == 'Masukkan emel anda') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Masukkan emel anda';}" /></p><input type="hidden" value="1" name="embed"/><input type="submit" value="Subscribe" /><p>Powered by <a href="http://tinyletter.com"> TinyLetter</a></p></form>