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
<!DOCTYPE html> | |
<!-- Replace your api_key, upload_preset, and cloud_name. For more information please see the blog post at --> | |
<html> | |
<body> | |
<script type="text/javascript"> | |
let doUpload = () => { | |
var files = document.getElementById("myid").files; | |
var formData = new FormData(); | |
for (file of files) { | |
formData.append('file', file); |
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
require 'digest' | |
database = ['123456', 'monkey', '1ljflkdjsiolk', 'abcdefghijk'] | |
def sha256(digest) | |
Digest::SHA256.hexdigest(digest) | |
end | |
puts "unencrypted passwords" | |
puts database |
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
#/bin/bash | |
usage() { echo "The usage is"; } | |
while getopts ':h:u:p:r:' opt; do | |
case "${opt}" in | |
h) HOST=${OPTARG};; | |
u) UNAME=${OPTARG};; | |
p) PWORD=${OPTARG};; | |
r) RUBY_VERSION=${OPTARG};; |
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
class String | |
def blank? | |
self.nil? || self.empty? | |
end | |
def present? | |
!self.blank? | |
end | |
end |
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
#/bin/sh | |
usage() { echo "Usage: $0 APP_NAME DESTINATION SCHEMA_NAME" 1>&2; exit 1; } | |
if [ "$#" -ne 3 ]; then | |
usage | |
fi | |
function pathParts() { | |
url=$1 |
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
sudo fallocate -l 16G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
sudo mount -a | |
swapon -s |
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 connect() { | |
const URL = 'wss://localhost:8080'; | |
const RECONNECT_DELAY = 1000; | |
const WAIT_FOR_NO_MESSAGE = 30000; | |
const handler = null; | |
var ws = new WebSocket(URL); | |
ws.onmessage = function(e) { | |
clearTimeout(handler); | |
setTimeout(() => ws.close(), WAIT_FOR_NO_MESSAGE); |
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
# https://deeplizard.com/learn/video/0VCOG8IeVf8 | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import os.path | |
# Optimizer to update the weights | |
import torch.optim as optim | |
import torchvision |
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
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'set' | |
require 'pry' | |
require 'csv' | |
require 'optparse' | |
require 'time' |
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 fetchSports(prefix, callback) { | |
console.log("prefix", prefix); | |
const sports = ["vikings", "vipers"]; | |
setTimeout(() => callback(sports), 500); | |
} | |
function fetchNews(prefix, callback) { | |
const news = ["victory", "votes"]; | |
setTimeout(() => { | |
callback(news); |
OlderNewer