Skip to content

Instantly share code, notes, and snippets.

@kisy
kisy / mt6701.py
Last active October 17, 2023 12:34
MT6701--Micropython
import machine
import time
# Define the chip select pin
cs_pin = machine.Pin(17, machine.Pin.OUT)
# Initialize SPI communication
spi = machine.SPI(0, baudrate=1000000, polarity=0, phase=0)
# Set the chip select pin high to disable the device
@kisy
kisy / mbim-start.sh
Last active April 5, 2023 13:27
Set mbim ip with systemd-networkd
#!/bin/bash
dev=wwan0
systemd_networkd_file=/etc/systemd/network/30-wwan0.network
ready_status=$(mbimcli -d /dev/cdc-wdm0 -p --query-subscriber-ready-status)
if [[ $ready_status == *"initialized"* ]]; then
connect_state=$(mbimcli -d /dev/cdc-wdm0 -p --query-connection-state)
@kisy
kisy / esp32-c3-sht4x.py
Last active February 25, 2023 13:42
CircuitPython esp32-c3 sht4x
import time
import board
import adafruit_sht4x
import microcontroller
import socketpool
import wifi
from adafruit_httpserver.mime_type import MIMEType
from adafruit_httpserver.request import HTTPRequest
@kisy
kisy / color-emoji-on-linux.sh
Created December 22, 2019 04:55 — forked from himalay/color-emoji-on-linux.sh
Color emoji on Arch Linux.
# create folders if does not exist
mkdir -p ~/.fonts
mkdir -p ~/.config/fontconfig/
# download noto color emoji font from https://www.google.com/get/noto/#emoji-zsye-color
# extract NotoColorEmoji.ttf file into ~/.fonts/
# create font config file
cat << 'EOF' > ~/.config/fontconfig/fonts.conf
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
@kisy
kisy / docker-compose.yml
Created December 18, 2019 06:07 — forked from ProteinPig/docker-compose.yml
基于Docker的家庭服务器
#Reference: https://www.smarthomebeginner.com/docker-home-media-server-2018-basic
#Requirement: Set environmental variables: USERDIR, PUID, PGID, MYSQL_ROOT_PASSWORD, and TZ as explained in the reference.
version: "2.4"
services:
######### FRONTENDS ##########
# Portainer - WebUI for Containers
portainer:
@kisy
kisy / git.sh
Created September 6, 2017 09:37 — forked from ohze/git.sh
specify ssh-key with git command
#!/bin/sh
# The MIT License (MIT)
# Copyright (c) 2013 Alvin Abad
if [ $# -eq 0 ]; then
echo "Git wrapper script that can specify an ssh-key file
Usage:
git.sh -i ssh-key-file git-command
"
@kisy
kisy / path2tree.php
Last active June 15, 2017 09:46
format path
<?php
$files = [
'2017/06/14/a.txt',
'2017/06/14/b.txt',
'2017/06/14/d.txt',
'2017/06/14/d.txt',
'2016/06/14/a.txt',
'2016/06/14/b.txt',
'2016/06/14/d.txt',
'2016/06/14/d.txt',
@kisy
kisy / SSHwithgit2go.go
Last active August 29, 2015 14:27 — forked from xorpaul/SSHwithgit2go.go
Working example with SSH and libgit2/git2go
package main
import (
git "github.com/libgit2/git2go"
"log"
)
func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) {
ret, cred := git.NewCredSshKey("git", "/home/vagrant/.ssh/id_rsa.pub", "/home/vagrant/.ssh/id_rsa", "")
return git.ErrorCode(ret), &cred
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
src_dir = './'
doc_root = '/vagrant_data/webroot'
app_name = File.basename(File.dirname(__FILE__))
config.vm.network :forwarded_port, guest: 80, host: 8080
apt-get update
apt-get install -q -y python-software-properties
add-apt-repository ppa:ondrej/php5
add-apt-repository ppa:chris-lea/node.js
apt-get install -q -y php5 php5-fpm php5-mssql php5-gd php5-imagick php5-mysql php5-curl php5-cli php5-pgsql
apt-get remove -q -y apache2
apt-get install -q -y nginx mysql-server git curl nodejs
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer