Skip to content

Instantly share code, notes, and snippets.

View KireinaHoro's full-sized avatar

Pengcheng Xu KireinaHoro

View GitHub Profile
@KireinaHoro
KireinaHoro / query_files.go
Last active May 4, 2021 16:11
Query Google Drive files with Golang
// slice of dictates for query
var q []string
//q = append(q, fmt.Sprintf("mimeType='%s'", driveFolderType))
//q = append(q, "name='Uncategorized'")
//q = append(q, "('0B9P4nJCkns_fWERqT3dfVENHMXM' in parents)")
q = append(q, "trashed=false")
q = append(q, "(name contains 'VCB')")
// construct the call for listing the requested files
listCall := srv.Files.List().PageSize(10).
@KireinaHoro
KireinaHoro / snmp.yml
Last active February 10, 2022 08:12
snmp_exporter config for Geist (Vertiv) IMD PDUs
# WARNING: This file was auto-generated using snmp_exporter generator, manual changes will be lost.
geist_imd:
walk:
- 1.3.6.1.4.1.21239.5.2.3
metrics:
- name: pduMainIndex
oid: 1.3.6.1.4.1.21239.5.2.3.1.1.1
type: gauge
help: Table entry index value - 1.3.6.1.4.1.21239.5.2.3.1.1.1
indexes:
package axi.sim
import spinal.core._
import spinal.core.sim._
import spinal.lib._
import spinal.lib.bus.amba4.axi._
import spinal.lib.bus.misc._
import spinal.lib.sim._
import scala.collection.mutable
package axi.sim
import pionic.RichByteArray
import spinal.core._
import spinal.core.sim._
import spinal.lib.bus.amba4.axi._
import spinal.lib.sim._
import java.util.concurrent.atomic.{AtomicBoolean, AtomicReference}
import scala.collection.mutable
package pionic
import axi.sim.{Axi4Master, Axi4StreamMaster, Axi4StreamSlave}
import spinal.core._
import spinal.core.sim._
import spinal.lib.BinaryBuilder
import scala.util._
case class PacketDescSim(addr: BigInt, size: BigInt)(implicit config: PioNicConfig) {
@KireinaHoro
KireinaHoro / photo-redate.swift
Created January 20, 2024 00:26
Update all photo dates from filename. Useful for bulk import into iCloud from Google Photos.
//
// main.swift
// photo-redate
//
// Created by Pengcheng on 19.01.2024.
//
import Foundation
import Photos
import os
@KireinaHoro
KireinaHoro / switch-vlan.ps1
Created January 21, 2024 17:16
Switch between VLANs with Hyper-V vEthernet
<#
Make adapter use gravity (untagged) or upstream network (tagged 1).
This depends on the switch (ER-X) configuration:
- upstream port has PVID=1 (untagged vlan 1)
- gateway port has PVID=1 VID=200 (untagged vlan 1, tagged vlan 200)
- downstream ports have PVID=200 VID=1 (untagged vlan 200, tagged vlan 1)
#>
#Requires -RunAsAdministrator
@KireinaHoro
KireinaHoro / bootstrap.sh
Last active February 4, 2024 04:21
Bootstrap aarch64-linux-android clang/llvm toolchain with sanitizers support
#!/bin/bash
# script that creates clang/llvm cross toolchain for aarch64 android target
# compile a hello world program that runs on AOSP Android:
# test with: adb push hello /data/cache && adb shell /data/cache/hello
# GCC:
# C: aarch64-linux-android-gcc hello.c -o hello -pie
# C++: aarch64-linux-android-g++ hello.cc -o hello -pie -fPIC -static-libgcc \
# -nostdlib -L/usr/local/aarch64-linux-android/lib -lc++ -lc -nostdinc++ \
# -I/usr/local/aarch64-linux-android/include/c++/v1 -std=c++11
# Clang/LLVM:
@KireinaHoro
KireinaHoro / aria2
Created January 15, 2018 06:49
service file for aria2
#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need net localmount
after bootmisc
}
start() {