Skip to content

Instantly share code, notes, and snippets.

View itsmepetrov's full-sized avatar
🏠
Working from home

Anton Petrov itsmepetrov

🏠
Working from home
View GitHub Profile
@itsmepetrov
itsmepetrov / edge_disable_bing_button.md
Created March 17, 2023 15:16
Disabling the Bing/Discovery button on macOS

How to get rid of Bing/Discovery button in Edge on macOS

Execute the following commands in the terminal:

/usr/bin/defaults write /tmp/com.microsoft.Edge.plist HubsSidebarEnabled -bool false
sudo mkdir /Library/Managed\ Preferences
sudo mv /tmp/com.microsoft.Edge.plist /Library/Managed\ Preferences/
@itsmepetrov
itsmepetrov / nvm_fix.sh
Created November 12, 2015 13:51
Fix NVM to use from root (or sudo)
# StackOverflow: http://stackoverflow.com/questions/21215059/cant-use-nvm-from-root-or-sudo
# Source: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps
# The below command seems to fix the problem
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
# The above command is a bit complicated, but all it's doing is copying whatever version of node
# you have active via nvm into the /usr/local/ directory (where user installed global files should
# live on a linux VPS) and setting the permissions so that all users can access them.
@itsmepetrov
itsmepetrov / recorderWorker.js
Created September 9, 2016 10:34
recorderWorker.js with bitrate decreasing
export default function inlineWorker() {
let recLength = 0,
recBuffers = [],
sampleRate,
numChannels;
this.onmessage = function(e){
switch(e.data.command){
case 'init':
init(e.data.config);
@itsmepetrov
itsmepetrov / README.md
Last active March 10, 2019 16:44
Docker compose for Homebridge with ZigBee plugin platform (Raspberry PI)

Docker compose for Homebridge with ZigBee plugin platform (Raspberry PI)

Installation

After running the docker compose configuration add homebridge-zigbee plugin using the following command:

docker-compose exec homebridge npm i homebridge-zigbee
const HomeKitDevice = require('../HomeKitDevice')
class GledoptoLedController extends HomeKitDevice {
static get description() {
return {
model: [
'GLEDOPTO',
],
manufacturer: 'GLEDOPTO',
name: 'GLEDOPTO Led Controller',
#EXTM3U
#EXTINF:0,Первый канал
#EXTGRP:другие
http://6557675f.ottclub.mobi/iptv/WXR5KQQTP3GSPP/127/index.m3u8
#EXTINF:0,Россия 1
#EXTGRP:другие
http://6557675f.ottclub.mobi/iptv/WXR5KQQTP3GSPP/504/index.m3u8
#EXTINF:0,НТВ
#EXTGRP:другие
http://6557675f.ottclub.mobi/iptv/WXR5KQQTP3GSPP/501/index.m3u8
const HomeKitDevice = require('../HomeKitDevice')
class AqaraTunableWhiteBulb extends HomeKitDevice {
static get description() {
return {
model: 'lumi.light.aqcn02',
manufacturer: 'LUMI',
name: 'Aqara Bulb',
}
}
const HomeKitDevice = require('../HomeKitDevice')
class IkeaTradfriDimmableBulb extends HomeKitDevice {
static get description() {
return {
model: [
'TRADFRI bulb E27 opal 1000lm',
'TRADFRI bulb E27 W opal 1000lm',
],
manufacturer: 'IKEA of Sweden',
const XIAOMI_STRUCT_ATTR = { id: 65281, type: 'charStr' }
const XIAOMI_STRUCT_OLD_ATTR = { id: 65282, type: 'charStr' }
const XIAOMI_MULTICLICK_ATTR = { id: 32768, type: 'boolean' }
const XIAOMI_PRESSURE_ATTR = { id: 16, type: 'int16' }
function parseXiaomiStruct(rawData) {
const buffer = new Buffer(rawData, 'ascii')
const data = {}
let index = 0
while (index < buffer.length) {
@itsmepetrov
itsmepetrov / classnames-loader-example.js
Last active June 4, 2018 16:39
This example shows the difference between classNames, classNames/bind and classnames-loader
// This example shows the difference
// between classNames, classNames/bind and classnames-loader
// submit-button.css
/*
:local .className {
color: green;
background: red;
}