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
| curl -s "http://worldtimeapi.org/api/ip"|sed 's/\(.*"datetime":"\)\(.*\)\(","abb.*$\)/datetime: \2/' | |
| #datetime: 2019-05-06T17:45:26.224134-05:00 |
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
| #base64 needs bytes like object so encode string first | |
| import base64 | |
| test = 'test' | |
| test = test.encode('utf-8') | |
| test_b64encoded = base64.b64encode(test) |
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
| #!/bin/bash | |
| #Get all files older than current month and archive them | |
| OIFS=$IFS | |
| IFS=$'\n' | |
| curr_seconds=$(date +%s) | |
| prev_seconds=$(date -v1d -v11H -v59M -v59S -v-1d +%s) | |
| echo $prev_seconds |
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
| https://security.stackexchange.com/a/19658 |
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 io | |
| #http://stackoverflow.com/questions/22459020/python-decode-utf-16-file-with-bom | |
| #https://docs.python.org/2/library/codecs.html | |
| #http://stackoverflow.com/questions/19644507/convert-different-encodings-to-ascii | |
| import io | |
| import os | |
| import math | |
| os.chdir('C:\Users\malexander\Dropbox\SFMC\Admin\Backups') |
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
| >>>title_list = ['psm'] | |
| >>>de_types = ['3P','IP','NL'] | |
| >>> for x in title_list: | |
| for y in de_types: | |
| de = '_'.join([x,y,'import']) | |
| print de | |
| psm_3P_import | |
| psm_IP_import |
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
| def shuffle(deck): | |
| s1 = len(deck) | |
| temp_deck = [] | |
| for card in deck: | |
| temp_deck.append(card) | |
| shuffled_deck = [] | |
| s2 = s1 - 1 | |
| while s1 != 0: | |
| rand1 = random.randint(0,s2) | |
| shuffled_deck.append(temp_deck.pop(rand1)) |
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
| Here's a handy query for finding duplicates in a table. Suppose you want to find all email addresses in a table that exist more than once: | |
| http://www.petefreitag.com/item/169.cfm | |
| SELECT email, | |
| COUNT(email) AS NumOccurrences | |
| FROM users | |
| GROUP BY email | |
| HAVING ( COUNT(email) > 1 ) |
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
| http://stackoverflow.com/questions/10908212/select-all-checkbox-by-javascript-or-console | |
| var allInputs = document.getElementsByTagName("input"); | |
| for (var i = 0, max = allInputs.length; i < max; i++){ | |
| if (allInputs[i].type === 'checkbox') | |
| allInputs[i].checked = true; | |
| } | |
| <!--http://www.webdevdoor.com/javascript-ajax/javascript-function-check-uncheck-checkboxes--> |
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
| '''Notes from an experiment in XML using Windows 7 and Python 2.7 trying to | |
| follow example from: | |
| http://docs.python-guide.org/en/latest/scenarios/scrape/#. | |
| 1) to get lxml on Windows machine had to install wheel file for libxml2.dll as | |
| pip install failed repeatedly (also Visual C++ 9.0) | |
| 2) The tried to parse MLB 2015 stats from this page: | |
| http://espn.go.com/mlb/standings/_/group/overall | |
| where xpath was //*[@id="main-container"]/div/section/div[2]/div/div[2]/table/tbody/tr[1]/td[2] | |
| however, this failed because browser xpath is not raw, and browser inserted a tbody where none existed in | |
| source code. Therefore, my queries failed until I went element by element!''' |
NewerOlder