A Pen by Tayfun Erbilen on CodePen.
This file contains 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
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list | |
curl -s -L https://nvidia.github.io/nvidia-container-runtime/experimental/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list | |
sudo apt-get update | |
sudo apt-get install -y nvidia-docker2 | |
sudo systemctl restart docker |
This file contains 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 blocking_io(): | |
print(f"start blocking_io at {time.strftime('%X')}") | |
# Note that time.sleep() can be replaced with any blocking | |
# IO-bound operation, such as file operations. | |
time.sleep(1) | |
print(f"blocking_io complete at {time.strftime('%X')}") | |
async def main(): | |
print(f"started main at {time.strftime('%X')}") |
This file contains 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 aiohttp | |
from aiohttp_socks import ProxyType, ProxyConnector, ChainProxyConnector | |
async def fetch(url): | |
connector = ProxyConnector.from_url('socks5://user:[email protected]:1080') | |
### or use ProxyConnector constructor | |
# connector = ProxyConnector( | |
# proxy_type=ProxyType.SOCKS5, |
This file contains 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
$('#up').on('click', function(e) { | |
e.preventDefault(); | |
let aliasIn = $('#alias').val() | |
let passIn = $('#pass').val() | |
gun.get("~@" + aliasIn).once(function (uAlias) { | |
if (uAlias === undefined) { | |
console.log("alias undefined, registering.") | |
user.create($('#alias').val(), $('#pass').val(), function (ack) { | |
console.log("create user ack: " + ack) | |
user.auth($('#alias').val(), $('#pass').val()); |
This file contains 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
gun.on('auth', function(){ | |
$('.loggedOut').hide(); | |
$('.loggedIn').show(); | |
user.get('said').map().once(UI); | |
user.get('alias').val(function(name){ | |
//console.log(name) | |
if(upPub !== null){ | |
let peers = gun.get('peers') | |
peers.once(function(data){ | |
let uSet = {name: name, pub: upPub} |
This file contains 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 setu(node, item){ | |
let unique = true | |
let comparison = function (data) { | |
let aProps = Object.getOwnPropertyNames(data); | |
let bProps = Object.getOwnPropertyNames(item); | |
// number of properties | |
if ((aProps.length-1) === bProps.length) { | |
for (let i = 1; i < aProps.length; i++) { | |
let propName = aProps[i]; | |
// values of same property |
This file contains 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
user.recall(6 * 60, { // minutes | |
session: true, | |
hook: function(props) { // { iat, exp, remember } | |
console.log("got to hook") | |
var passed = (Time.now() / 1000) - props.iat; // seconds internally | |
return (passed < exp) ? ((props.exp += passed) && props) : props; | |
} | |
}).then(function(ack) { | |
console.log("got to then") | |
if (ack && ack.sea) { |
This file contains 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 setu(node, item){ | |
let unique = true | |
node.map().once(function (data) { | |
let aProps = Object.getOwnPropertyNames(data); | |
let bProps = Object.getOwnPropertyNames(item); | |
// number of properties | |
if ((aProps.length-1) === bProps.length) { | |
for (let i = 1; i < aProps.length; i++) { | |
let propName = aProps[i]; | |
// values of same property |
This file contains 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 setu(node, item){ | |
let unique = true | |
node.map().once(function (data) { | |
let aProps = Object.getOwnPropertyNames(data); | |
let bProps = Object.getOwnPropertyNames(item); | |
// number of properties | |
if (aProps.length === bProps.length) { | |
console.log("same len") | |
for (let i = 0; i < aProps.length; i++) { | |
let propName = aProps[i]; |
NewerOlder