Skip to content

Instantly share code, notes, and snippets.

View GitHubEmploy's full-sized avatar
👾
Coding Like A Pro

Mohit Varikuti GitHubEmploy

👾
Coding Like A Pro
View GitHub Profile
const hex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`;
console.log(hex());
const even = num => num % 2 === 0;
console.log(even(2)); // true
console.log(even(3)); // false
const isBrowserTabInView = () => document.hidden;
isBrowserTabInView();
const reverse = str => str.split('').reverse().join('');
console.log(reverse('cake is yummy'));
// Result: 'ymmuy si ekac'
const week = (date) => date.getDay()% 6 !== 0;
console.log(week(new Date(2021, 0, 11))); // Result: true (Monday)
console.log(week(new Date(2021, 0, 15))); // Result: false (Sunday)
const randomBoolean = () => Math.random() >= 0.5;
console.log(randomBoolean());
import time
start_time = time.time()
for loop in range(1, 100000000):
pass
print('FINISHED EXECUTION')
print("--- %s seconds ---" % round(time.time() - start_time, 4))
// ==UserScript==
// @name Geoguessr Cheat
// @namespace https://www.leonbrandt.com
// @version 2.0.0
// @description Press SHIFT + ALT + G and the location of your current geoguessr game will open in a new tab
// @author Leon Brandt
// @homepage https://www.leonbrandt.com
// @updateURL https://gist.githubusercontent.com/leonbrandt/16b3a70ef70939359357c908e6b0f06d/raw/geoguessr-cheat.user.js
// @match http*://*/*
// @grant none
torch.save(model.state_dict(), 'model.ckpt')
with torch.no_grad():
correct = 0
total = 0
for images, labels in test_loader:
images = images.to(device)
labels = labels.to(device)
outputs = model(images)
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0)
correct += (predicted == labels).sum().item()