This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python xlogd.py sample.log | |
parsed: {'appname': 'test.app', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '68898', 'priority': '132', 'message': 'bla bla bla warn'} | |
parsed: {'appname': 'test.app', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '68902', 'priority': '131', 'message': 'bla bla bla error'} | |
parsed: {'appname': 'Dock', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '154', 'priority': '11', 'message': 'CGSReleaseWindowList: called with 5 invalid window(s)'} | |
parsed: {'appname': 'WindowServer', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '79', 'priority': '11', 'message': 'CGXSetWindowListAlpha: Invalid window 0'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pretty print a date range MMDDYYYY | |
// argument is the number of days for the date range | |
console.log(printDateRange(365)); | |
function printDateRange(days){ | |
let options = {timeZone: 'America/Chicago'} // set timeZone using IANA tz | |
let curr = new Date(), prev = new Date(); | |
prev.setDate((prev.getDate() - days)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$html = ' | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title><?=$title?></title> | |
</head> | |
<body> | |
<p id="thisP">Some stuff here to parse! ABCDEFGHIJKLMNOPQRSTUVWXYZ</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Item = function(name, cost){ | |
this.name = name; | |
this.isTopLevel = true; | |
this.baseCost = cost; | |
this.attributes = []; | |
this.totalCost = function(){ | |
let total = this.baseCost; | |
this.attributes.map(x=>{ | |
total += x.cost; | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const regex = /^(.*product)\/cache.*(\/[a-z]\/[a-z]\/.*)/g; | |
let testUri = window.prompt('Input the full image url to be cleaned:'); | |
let m; | |
let uriArr = []; | |
let cleanUri; | |
while ((m = regex.exec(testUri)) !== null) { | |
if (m.index === regex.lastIndex) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node v 8.5.0 (should work with earlier as long as regex available) & ES6 | |
const axios = require('axios'); | |
const fs = require('fs'); | |
const parse = require('csv-parse'); | |
const delimiter = ','; | |
const filename = 'update.csv'; | |
const endpoint = 'https://api.ebay.com/ws/api.dll'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, csv | |
import pandas as pd | |
from collections import Counter | |
from random import randint | |
csvfile = 'mycsvfile.csv' | |
# regex = r'\w+' | |
regex = r"\b[^\d\W]+\b" # this will get omit words containing numbers like 4WD or a part number 123ABCD | |
commonWords = ['a', 'with', 'the', 'and', 'set', 'foot', 'for', 'inch', 'on', 'models', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This involves some manual work depending on the type and category of an item | |
# See below !! CATEGORY / ITEM SPECIFIC INFO !! | |
import requests | |
from bs4 import BeautifulSoup as BS | |
# !! CATEGORY / ITEM SPECIFIC INFO | |
# This function is for the list filter and is some information that unfortunately couldn't be exluded with Beautiful Soup | |
# (or I just couldn't figure it out) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timestampIt(){ | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = ss.getSheets()[0]; // this will assign the first sheet | |
var cell = sheet.getRange('A1'); | |
var d = new Date(); | |
d.setHours(d.getHours() +1); | |
var user = Session.getActiveUser().getUserLoginId(); | |
user = String(user); | |
user = user.replace('@gmail.com', ''); | |
cell.setValue('Last updated: ' + d.toLocaleString() + ' by ' + user); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
# Python 3.6.3 | |
# hold on to your butts | |
driver_path = '/usr/local/bin/chromedriver' | |
url = 'https://www.amazon.com/reviews/iframe?akid=AKIAIOWAH2MM2J3QSNPA&alinkCode=xm2&asin=B006R7AW6M&atag=AssociateTag%3Dsomeutility-20&exp=2017-11-02T21%3A59%3A44Z&v=2&sig=ljBbKJxQiq%252F90us8lfn1uDQ7VmXr%252BDknLvJ49jIsaHU%253D' | |
try: | |
browser = webdriver.Chrome(executable_path=driver_path) |
OlderNewer