Skip to content

Instantly share code, notes, and snippets.

@jay
jay / multi_vs_easy.cpp
Last active October 31, 2021 05:09
Use libcurl to test multi vs easy performance.
/* Use libcurl to test multi vs easy performance.
Usage: multi_vs_easy
This program compares the different methods that can be used to make transfers
to the same host. The code was written only for the purpose of comparison of
the different methods.
g++ -o multi_vs_easy multi_vs_easy.cpp `curl-config --cflags --libs`
@pierew
pierew / pvenode-rename
Created February 18, 2019 19:07
Changing a Proxmox VE Nodes name when it is not in a cluster
OLDNAME=$(hostname)
hostnamectl set-hostname ${1}
mkdir -p /etc/pve/nodes/${1}
cp -a /etc/pve/nodes/${OLDNAME} /etc/pve/nodes/${1}
echo 'A reboot is required, Exit with CTRL-C'
read
@AdamNaj
AdamNaj / about.md
Last active July 13, 2022 19:50
Z Wave Graph for Home Assistant
// identifier(s) should be in the following format:
// {
// resultName: 'name of key that will be used in the returned object',
// identifier: 'identifier that will be searched for in the format'
// }
function breakDown(string, format, identifiers){
for(let i = 0; i < identifiers.length; i++){
const identifier = identifiers[i];
identifier.index = format.indexOf(identifier.identifier);
}
@ciotlosm
ciotlosm / Readme.md
Last active February 5, 2024 15:04
Kiosk mode for lovelace

Kiosk mode

Installation

Add kiosk.js file with the content below to your www folder in config.

Like any other custom script, use ui-lovelace.yaml resources section to reference the kiosk.js file.

Make sure you add kiosk somewhere in your URL. You can use it in the id of your view or in the query string.

// APIStoreProps are properties that need to be
// ignored when running APIStore.makeStore()
const APIStoreProps = ['use', 'classes', 'constructor', 'init', 'state']
// getMethods returns methods defined
// in a given class' prototype, except init and constructor
const getMethods = (cls) => {
return Object.getOwnPropertyNames(cls.prototype)
.reduce((obj, prop) => {
@thmsobrmlr
thmsobrmlr / hubspot-meetings-conversion-tracking.js
Created March 27, 2018 21:04
Track conversions of Hubspot Meetings (iframe)
function isHubspotUrl(url) {
var hubspotUrls = [
'https://local.hubspot.com',
'https://app.hubspotqa.com',
'https://app.hubspot.com',
'https://meetings.hubspot.com'
];
return hubspotUrls.indexOf(url) > -1
}
if (process.version.startsWith("v6")) throw new Error("This Bot requires Node 7v+ because of async/await")
const Discord = require("discord.js")
const express = require("express")
const app = express()
const superagent = require("superagent")
//Config
let INVITE = process.env.INVITE || "", //An Infinite Invite to your discord server.
GUILD = process.env.GUILD || "", //The ID of the Guild for this invite ^
// identifier(s) should be in the following format:
// {
// resultName: 'name of key that will be used in the returned object',
// identifier: 'identifier that will be searched for in the format'
// }
function breakDown(string, format, identifiers){
for(let i = 0; i < identifiers.length; i++){
const identifier = identifiers[i];
identifier.index = format.indexOf(identifier.identifier);
}
@Kylmakalle
Kylmakalle / main.py
Created August 6, 2017 19:10 — forked from gurland/main.py
How to delete all your messages from chat in telegram? Easy, just use this program
from telethon import TelegramClient
from telethon.errors import SessionPasswordNeededError
from telethon.tl.functions.messages import GetHistoryRequest
from telethon.tl.functions.channels import DeleteMessagesRequest
from telethon.tl.types.channel import Channel
import shelve
from os import listdir
from time import sleep
# Просто утилиты