Skip to content

Instantly share code, notes, and snippets.

@sapher
sapher / gist:ad6c727d8ef4ce460bec98b695054be1
Created September 9, 2024 20:32
garage door zigbee (change device id)
"""Tuya based cover and blinds."""
from typing import Dict
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Ota, Scenes, Time
from zigpy.zcl.clusters.security import IasZone
from zhaquirks.const import (
@sapher
sapher / install.sh
Last active June 16, 2023 09:29
Conf WS2
sudo apt-get update -y
sudo apt-get upgrade -y
# Install packages
sudo apt-get install zsh git unzip curl wget build-essential jq file -y
# Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Install brew
@sapher
sapher / crane_delete_repo.sh
Created November 5, 2022 19:00
crane delete repo
crane auth login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
crane delete "${FULL_IMAGE_NAME}@$(crane digest ${FULL_IMAGE_NAME})"

Install and configure External Secret Operator (ESO)

Install external-secret with Helm

helm repo add external-secrets https://charts.external-secrets.io

helm upgrade --install --create-namespace -n eso external-secrets \
    external-secrets/external-secrets \
    -n external-secrets \
@sapher
sapher / main.py
Created July 15, 2022 16:32
Parse SUPER U monmagasin U ticket
#!/usr/bin/env python3
from asyncore import read
import argparse
from PyPDF2 import PdfReader
import re
import json
if __name__ == "__main__":
package sapher.com.instabooth.ui;
import android.content.Context;
import android.content.res.Configuration;
import android.view.OrientationEventListener;
import android.view.Surface;
import android.view.WindowManager;
import java.util.concurrent.locks.ReentrantLock;
@sapher
sapher / lambda.js
Last active May 25, 2017 04:24
AWS Lambda (use lambda proxy) for registering FCM refresh token to AWS SNS
const AWS = require('aws-sdk');
const SnsClient = new AWS.SNS();
const createEndpoint = (platformAppArn, token, callback) => {
const createParams = {
PlatformApplicationArn: platformAppArn,
Token: token
};
@sapher
sapher / my_activity.java
Created February 5, 2017 11:22
Bluetooth with Android +6
package gardenator.sapher.com.gardenator.activities;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import org.androidannotations.annotations.AfterViews;
@sapher
sapher / template.json
Last active June 3, 2019 04:50
Packer.io template file for RancherOS
{
"variables": {
"ros_version" : "v0.5.0",
"iso_md5" : "467caa8394684ba54e8731aed8480652",
"vm_name" : "rancher_image"
},
"builders": [
{
"type": "vmware-iso",
"iso_url": "https://releases.rancher.com/os/{{ user `ros_version` }}/rancheros.iso",
@sapher
sapher / aws-elastictranscoder.java
Created May 17, 2016 17:19
Simple Snippet that show how to create a conversion job on AWS ElasticTranscoder
// Create ElasticTranscoderClient
AWSCredentials credentials = new DefaultAWSCredentialsProviderChain().getCredentials();
AmazonElasticTranscoderClient client = new AmazonElasticTranscoderClient(credentials);
client.configureRegion(Regions.US_WEST_2);
// JobInput
JobInput jobInput = new JobInput();
jobInput.setKey(key); // name of the input object in your source S3
// Create JobOuput