Skip to content

Instantly share code, notes, and snippets.

/*
INSTALLATION:
1. Open https://discord.com/developers/applications and create new application
2. Open Bot tab and set it up
3. Generate or reset token for your bot, copy paste it to BOT_TOKEN variable down below on line 23
4. Open OAuth2 > URL Generator tab, select "bot" scope, select "Send Messages" bot permissions, copy generated url, open it and invite your bot to your server
5. Open discord, copy ID of the channel where you want messages to appear, paste it to CHANNEL_ID variable down below on line 24
6. Click "Find Refs" in streamer.bot's Execute C# Code window
7. Open "References" tab in streamer.bot's Execute C# Code window, right click, click "Add reference from file...", navigate to "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" and add "System.XML.dll" file
@Kanawanagasaki
Kanawanagasaki / wpf-monospace-fonts.cs
Last active November 19, 2022 16:18
[C#, WPF] Print all available monospace fonts
char[] charSizes = new char[] { 'i', 'a', 'Z', '%', '#', 'a', 'B', 'l', 'm', ',', '.' };
foreach (var fontFamily in Fonts.SystemFontFamilies)
{
foreach (var typeface in fontFamily.GetTypefaces())
{
double firstWidth = 0d;
foreach (char ch in charSizes)
{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
using System;
class Player
{
static void Main(string[] args)
{
// Reading inputs
string[] inputs = Console.ReadLine().Split(' ');
int width = int.Parse(inputs[0]);
int height = int.Parse(inputs[1]);
[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(!
const minTimeToVisitAllPoints = (points) => {
let res = 0;
for(let i = 0; i < points.length - 1; i++)
res += Math.max(Math.abs(points[i + 1][0] - points[i][0]), Math.abs(points[i + 1][1] - points[i][1]));
return res;
};
const uniqueOccurrences = (arr) =>
{
const map = {};
for(const num of arr)
map[num] = (map[num] || 0) + 1;
const values = Object.values(map);
return values.length == new Set(values).size;
};
var kthDistinct = function(arr, k) {
for(let i = 0; i < arr.length; i++)
{
let index = arr.indexOf(arr[i], i + 1);
if(index >= 0)
{
while(index >= 0)
{
arr.splice(index, 1);
const numberOfPairs = (nums) => {
let map = {};
for(let num of nums)
if(num in map) map[num]++;
else map[num] = 1;
let pairsAmount = 0;
let leftovers = 0;
for(let key in map)
{
let pairs = Math.floor(map[key] / 2);
const twoOutOfThree = (n1, n2, n3) => {
const intersect1 = n1.filter(v => n2.includes(v));
const intersect2 = n2.filter(v => n3.includes(v));
const intersect3 = n3.filter(v => n1.includes(v));
return Array.from(new Set([...intersect1, ...intersect2, ...intersect3]));
};