(Jan 2, 2021) Ask HN: Successful one-person online businesses in 2021?
https://news.ycombinator.com/item?id=25614966
(Dec 12, 2020) Ask HN: Successful one-person online businesses?
| const allContent = [] | |
| function createCSV(data, fileName) { | |
| const headers = [ | |
| 'id', | |
| 'email', | |
| 'firstName', | |
| 'lastName', | |
| 'postId', | |
| 'postText', |
| // Async function to handle JSON or encrypted response | |
| let decryptResponse = async (response) => { | |
| let result; | |
| // These are Base64 encoded arrays used as the key and IV for AES-GCM decryption | |
| let base64IV = | |
| "Wzk3LCAxMDksIC0xMDAsIC05MCwgMTIyLCAtMTI0LCAxMSwgLTY5LCAtNDIsIDExNSwgLTU4LCAtNjcsIDQzLCAtNzUsIDMxLCA3NF0="; | |
| let base64Key = | |
| "Wy0zLCAtMTEyLCAxNSwgLTEyNCwgLTcxLCAzMywgLTg0LCAxMDksIDU3LCAtMTI3LCAxMDcsIC00NiwgMTIyLCA0OCwgODIsIC0xMjYsIDQ3LCA3NiwgLTEyNywgNjUsIDc1LCAxMTMsIC0xMjEsIDg5LCAtNzEsIDUwLCAtODMsIDg2LCA5MiwgLTQ2LCA0OSwgNTZd"; |
| async function scrollDown() { | |
| const wrapper = document.querySelector("#search-page-list-container"); | |
| await new Promise((resolve, reject) => { | |
| var totalHeight = 0; | |
| var distance = 600; | |
| var timer = setInterval(async () => { | |
| var scrollHeightBefore = wrapper.scrollHeight; | |
| wrapper.scrollBy(0, distance); | |
| totalHeight += distance; |
| /* | |
| Author: https://github.com/gorhill | |
| Source: https://gist.github.com/gorhill/5285193 | |
| A Go function to render a number to a string based on | |
| the following user-specified criteria: | |
| * thousands separator | |
| * decimal separator |
| from urllib.parse import urlparse | |
| def parse_domain_name(url: str) -> str: | |
| """ | |
| Parse the domain name from the given url. | |
| """ | |
| return urlparse(url).hostname.split('.')[-2] |
(Jan 2, 2021) Ask HN: Successful one-person online businesses in 2021?
https://news.ycombinator.com/item?id=25614966
(Dec 12, 2020) Ask HN: Successful one-person online businesses?
| function addCss(rule) { | |
| // https://stackoverflow.com/a/38063486 | |
| let css = document.createElement('style'); | |
| css.type = 'text/css'; | |
| if (css.styleSheet) { | |
| css.styleSheet.cssText = rule; // Support for IE | |
| } | |
| else { | |
| css.appendChild(document.createTextNode(rule)); // Support for the rest | |
| } |
| import socket | |
| import sys | |
| def isOpen(ip, port): | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| try: | |
| s.connect((ip, int(port))) | |
| s.shutdown(2) | |
| return True |
| // See all event listeners on the page. | |
| // Ref: https://stackoverflow.com/a/45842339 | |
| // | |
| Array.from(document.querySelectorAll('*')) | |
| .reduce(function(pre, dom){ | |
| var evtObj = getEventListeners(dom) | |
| Object.keys(evtObj).forEach(function (evt) { | |
| if (typeof pre[evt] === 'undefined') { | |
| pre[evt] = 0 | |
| } |
| alias changefileperms='find . -type d -perm 777 -exec chmod 755 {} \; && find . -type f -perm 777 -exec chmod 644 {} \;' |