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://stackexchange.com/about/moderators?by=users | |
JSON.stringify(Array.from(document.querySelectorAll('.mods-summary-list')).filter(e=>e.children.length>1).map(e=>Array.from(e.children).map(x=>x.hostname.split('.')[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
w = new WebSocket("wss://qa.sockets.stackexchange.com/"); | |
w.onmessage = function(e) { | |
d = JSON.parse(e.data).data; | |
console.log(d); | |
if (d == "hb") { | |
w.send("hb"); | |
} | |
}; | |
w.onopen = function() { | |
w.send("4606062-topbar"); |
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 | |
import urllib.request | |
from bs4 import BeautifulSoup | |
from operator import itemgetter | |
from time import sleep | |
account_id = 'YOUR ACCOUNT ID HERE' | |
network_profile = 'http://stackexchange.com/users/' + account_id + '?tab=accounts' | |
with urllib.request.urlopen(network_profile) as response: |
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
b=document.querySelector('.wmd-input.processed'); | |
if (b) { | |
a=b.value; | |
a=a.replace(/\bi(?=\s|\')/g,'I'); | |
a=a.replace(/\b[Ii]m\b/g,'I\'m'); | |
a=a.replace(/\b[Ii]ve\b/g,'I\'ve'); | |
a=a.replace(/\b(ca|did|do|does|has|is|was|were|wo)nt\b/gi,'$1n\'t'); | |
a=a.replace(/\b(w|t)hats\b/gi,'$1hat\'s'); | |
a=a.replace(/\b(c|w|sh)ouldnt\b/gi,'$1ouldn\'t'); | |
a=a.replace(/\b(t)heres\b/gi,'$1here\'s'); |
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 scipy.optimize as optimization | |
def u(x, a): | |
return numerical_integral(lambda t: x*a+t, 0, 1)[0] | |
print optimization.curve_fit(u, [1,2,3], [1,3,2], [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
A = [0 1 1 0 1 1; 2 1 1 0 3 0; 0 0 0 4 0 2; 3 2 1 0 1 0; 0 0 1 1 0 3] | |
[U,D,V] = svd(A) | |
D2 = D.*(D>=5) | |
A2 = U*D2*V' | |
for j=1:6 disp(A2(1,j)/norm(A2(:,j))); end |
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
\documentclass[tikz]{standalone} % last update March 2016 | |
\usepackage[utf8]{inputenc} | |
\usepackage[T1]{fontenc} | |
\title{Moderator chart} | |
\begin{document} | |
\definecolor{rows}{rgb}{0.95,0.95,0.95} | |
\definecolor{myblue}{rgb}{0.1,0.3,0.9} | |
\definecolor{mypurple}{rgb}{0.5,0.3,0.7} | |
\begin{tikzpicture}[scale=0.5] | |
% 1 horizontal unit = 1 month, 0 = january 2010 |
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
c = document.querySelectorAll('.user-details a'); | |
a = []; | |
for (var i=0; i < c.length; i++) { | |
a.push(c[i].href.split('/')[4]); | |
} | |
console.log(a.join()); |
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
f = @(x,y) 100*(x.^2-y).^2 + (x-1).^2; % Rosenbrock's function | |
x = -2:0.1:2; | |
y = -2:0.1:2; | |
[X,Y] = meshgrid(x,y); | |
contour (x,y, f(X,Y), 30); | |
hold on | |
T = [-2 -1; 2 0; -1 1]; | |
for i = 1:3 | |
z(i) = f(T(i,1),T(i,2)); |
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
f = @(x) 55*cos(x)-x; | |
a = 0; | |
b = 8; | |
fa = f(a); | |
fb = f(b); | |
if sign(fa) == sign(fb) | |
error('No bracket'); | |
end | |
while(b-a > 1e-9) | |
c = (a+b)/2; |
NewerOlder