Discover gists
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
{ | |
"workbench.startupEditor": "newUntitledFile", | |
"editor.fontSize": 14, | |
"editor.lineHeight": 1.8, | |
"javascript.suggest.autoImports": true, | |
"javascript.updateImportsOnFileMove.enabled": "always", | |
"editor.rulers": [80, 120], | |
"extensions.ignoreRecommendations": true, | |
"typescript.tsserver.log": "off", | |
"files.associations": { |
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 numpy as np | |
from tqdm import trange | |
def get_neighbour_matrix(x, L, R): | |
dx = np.subtract.outer(x[:, 0], x[:, 0]) | |
dy = np.subtract.outer(x[:, 1], x[:, 1]) | |
dx[dx > (L / 2) ** 2] -= (L / 2) ** 2 | |
dy[dy > (L / 2) ** 2] -= (L / 2) ** 2 | |
pair_dist = dx ** 2 + dy ** 2 |
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 | |
if [[ $(whoami) != "root" ]] | |
then echo "Please run as root" | |
exit 1 | |
fi | |
if [ "$(ls /bin | grep trizen)" == "trizen" ] | |
then | |
PKGMAN=trizen | |
else |
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 | |
brew list | while read cask; do echo -ne "\x1B[1;34m $cask \x1B[0m"; brew uses $cask --installed | awk '{printf(" %s ", $0)}'; echo ""; done |
This cheatsheet shows how to install and configure multipath tools on Proxmox PVE Cluster where multiple nodes share single storage with multipath configuration, for example SAN storage connected to each of the nodes by two independent paths.
This cheatsheet has been tested on Proxmox 5.x.
I do not prepend sudo
command to any of commands listed here, but keep in mind that nearly all commands requires su privileges, so use sudo
if your account happen to not have root access.
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
// There's some better solutions in the comments, so scroll down and see how other folks have improved this! | |
// USAGE: | |
// abbrState('ny', 'name'); | |
// --> 'New York' | |
// abbrState('New York', 'abbr'); | |
// --> 'NY' | |
function abbrState(input, to){ | |
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
--- | |
- hosts: localhost | |
connection: local | |
gather_facts: true | |
tasks: | |
- name: Add APT repositories | |
when: ansible_os_family == 'Debian' | |
become: true | |
block: |
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
/* Twitch Quest Fixer v3.1 */ | |
const extensionID = "ehc5ey5g9hoehi8ys54lr6eknomqgr"; | |
const channel = location.pathname.slice(1).toLowerCase(); | |
const channelId = __APOLLO_CLIENT__.cache.data.data.ROOT_QUERY["channel({\"name\":\""+channel+"\"})"].__ref.split(":")[1]; | |
const pollDuration = 60000; | |
let authToken = __APOLLO_CLIENT__.cache.data.data["Channel:" + channelId].selfInstalledExtensions.filter(x => x.helixToken.extensionID == extensionID)[0].token.jwt; | |
grantPermission = async () => { | |
console.log("Attempting to grant permission automatically..."); | |
const integrityResponse = await (await fetch("https://gql.twitch.tv/integrity", { method: "post", headers: commonOptions.headers })).json(); |
NewerOlder