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 averageColor(a, b) { | |
let ar = parseInt(a.substr(0, 2), 16) | |
ar *= ar | |
let ag = parseInt(a.substr(2, 2), 16) | |
ag *= ag | |
let ab = parseInt(a.substr(4, 2), 16) | |
ab *= ab | |
let br = parseInt(b.substr(0, 2), 16) | |
br *= br | |
let bg = parseInt(b.substr(2, 2), 16) |
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
#[macro_use] | |
extern crate log; | |
use rand::Rng; | |
use rand::prelude::ThreadRng; | |
use serde::Serialize; | |
use std::env; | |
use std::thread; | |
use std::time::SystemTime; | |
use reqwest::blocking::Client; |
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
.tostr : To string | |
ANY → str($expr$) |
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/python3 | |
import sys | |
import os | |
import requests | |
import time | |
from requests.auth import HTTPBasicAuth | |
import xml.etree.ElementTree as ET | |
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 find . -type d -exec chgrp webmanager {} + | |
sudo find . -type d -exec chmod g+s {} + | |
sudo find . -type d -exec setfacl -m default:group::rwx {} + |
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 java.util.* | |
class TreeNode(var `val`: Int) { | |
var left: TreeNode? = null | |
var right: TreeNode? = null | |
} | |
typealias LeetNode = TreeNode | |
fun LeetNode.toNode(): Node<Int> { | |
return Node(`val`).apply { |
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 java.util.ArrayList; | |
//Definition of Node | |
class Node { | |
String name; // Name of the node | |
ArrayList<Node> connectedNodes = new ArrayList<>(); // All nodes connected to this node | |
// Constructor, called when use `new Node("name")` | |
Node(String n) { | |
name = n; |
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
ffmpeg -i input.mp4 -filter:v subtitles=subtitle.srt -c:a copy -c:v libx264 -crf 22 -preset veryfast output.mp4 |
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
VBoxManage modifyvm "MacOS Catalina" --cpuid-set 00000001 000106e5 00100800 0098e3fd bfebfbff | |
VBoxManage setextradata "MacOS Catalina" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3" | |
VBoxManage setextradata "MacOS Catalina" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" | |
VBoxManage setextradata "MacOS Catalina" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" | |
VBoxManage setextradata "MacOS Catalina" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" | |
VBoxManage setextradata "MacOS Catalina" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 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
import requests | |
import winsound | |
def get_latest_crypto_price(): | |
response = requests.get('https://api.coinmarketcap.com/v1/ticker/bitcoin') | |
response_json = response.json() | |
return float(response_json[0]['price_usd']) | |
last_price = 100000 | |
while True: |
NewerOlder