Skip to content

Instantly share code, notes, and snippets.

View NeuronQ's full-sized avatar
🎯
Focusing

Andrei Anton NeuronQ

🎯
Focusing
View GitHub Profile
// sync_scrape.js (tested with node 11.3)
const request = require("sync-request");
const fetchUrl = url => {
console.time(`fetchUrl(${url})`);
const html = request("GET", url).getBody();
console.timeEnd(`fetchUrl(${url})`);
return html;
};
# sync_scrape.py (needs Python 3.7+)
import time, re, requests
def fetch_url(url):
t = time.perf_counter()
html = requests.get(url).text
print(f"time of fetch_url({url}): {time.perf_counter() - t:.2f}s")
return html
def scrape_data(html):
@NeuronQ
NeuronQ / widows-remap-capslock2ctrl.ps
Created January 13, 2018 20:51
run in PowerShell as Admin, changes take effect after reboot
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
@NeuronQ
NeuronQ / windows-remap-capslock2ctrl.reg
Last active January 13, 2018 20:52
Save in file with .reg extension. Import requires Admin privileges (use Admin user or run Regedit as Admin)
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00
@NeuronQ
NeuronQ / screen-cheatsheet.sh
Last active August 17, 2017 13:46
UNIX Screen cheatheet
#!/bin/cat
# Intro to using UNIX Screen
## Basics
screen -list # LIST current screen sessions
screen -S myscreen1 # CREATE a new session named *myscreen1*
@NeuronQ
NeuronQ / gist:40990f72f51938e527906884f82a3e27
Last active October 5, 2021 00:42
WP_HOME vs WP_SITEURL
WP_HOME - where home is
homeurl
home_url()
Site Address (URL)
http://example.com
WP_SITEURL - where wordpress is (when having wp in a subdirectory home without the subdir path, like at https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
siteurl
site_url()
@NeuronQ
NeuronQ / python-shell-like-script.py
Created April 24, 2017 21:05
Boilerplate for writing "shell-like" Python scripts
#!/usr/bin/env python
# both python 2 and 3 comatible
from __future__ import absolute_import, division, print_function, unicode_literals
try:
input = raw_input
except NameError:
pass
import sys
@NeuronQ
NeuronQ / zero2hero-ubuntu16.sh
Created June 20, 2016 04:31
Quickly install dev essentials (ubuntu 16 version)
#!/usr/bin/env sh
sudo apt-get update -y
# C compilers and stuff
sudo apt-get install -y build-essential
# unzip
sudo apt-get install -y unzip
@NeuronQ
NeuronQ / ssh-agent-autostart.sh
Created June 20, 2016 04:30
ssh-agent autostart (bash) - add this to .bashrc
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@NeuronQ
NeuronQ / bash-powerline.sh
Last active August 28, 2016 13:52
My custom version of bash-powerline - ultra-lightweight custom bash prompt with git info
#!/usr/bin/env bash
__powerline() {
# Unicode symbols
readonly PS_SYMBOL_DARWIN=''
readonly PS_SYMBOL_LINUX='$'
readonly PS_SYMBOL_OTHER='%'
readonly GIT_BRANCH_SYMBOL='⑂ '
readonly GIT_BRANCH_CHANGED_SYMBOL='+'