Skip to content

Instantly share code, notes, and snippets.

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
aaron-bond.better-comments
akamud.vscode-theme-onelight
alefragnani.bookmarks
alefragnani.project-manager
alexdauenhauer.catppuccin-noctis
amiralizadeh9480.laravel-extra-intellisense
amodio.toggle-excluded-files
andenetalexander.vim-cheatsheet
ashinzekene.nestjs
asvetliakov.vscode-neovim
@timsheu
timsheu / simple_calc.py
Created November 21, 2021 14:50
simple_calc.py
from cmd import Cmd
class SimpleCalc(Cmd):
def do_plus(self, line: str):
params = line.split(' ')
if len(params) == 1:
print('lack of arguments')
return
try:
extension Encodable {
func encode(with encoder: JSONEncoder = JSONEncoder()) throws -> Data {
return try encoder.encode(self)
}
}
extension Decodable {
static func decode(with decoder: JSONDecoder = JSONDecoder(), from data: Data) throws -> Self {
return try decoder.decode(Self.self, from: data)
}
@timsheu
timsheu / WebAPIInterface.kt
Created December 17, 2018 09:52
Retrofit with RxKotlin sample
package com.nuvoton.nupowerstation
import com.nuvoton.nupowerstation.model.RequestLogin
import com.nuvoton.nupowerstation.model.ResponseLogin
import io.reactivex.Observable
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Body
import retrofit2.http.HeaderMap
@timsheu
timsheu / php
Last active May 10, 2018 14:29
query.php
# Tested with browser command:
# http://127.0.0.1/query.php?ipAddress=127.0.0.1&dbLogin=root&dbPassword=48694062&dbName=SURLMICE_TWEET_apple&sqlCommand=SHOW%20TABLES
# Result
# [{"Tables_in_surlmice_tweet_apple":"2013_07_07"},{"Tables_in_surlmice_tweet_apple":"2014_05_28"},{"Tables_in_surlmice_tweet_apple":"2016_04_28"}]
<?php
$ip_address = $_REQUEST['ipAddress'];
$db_login = $_REQUEST['dbLogin'];
$db_pass = $_REQUEST['dbPassword'];
$db_name = $_REQUEST['dbName'];
@timsheu
timsheu / ECDH.txt
Last active May 7, 2018 01:23
Use SpongyCastle to reconstruct ECDH private/public keys to ECPrivateKey/ECPublicKey
/**
* Code is written in Kotlin on Android Platform
* Uses SpongyCastle rather than BouncyCastle
*
* The use case is described as below.
*
* A embedded C platform device generates a pair of ECDH key with prime256v1 and passes the public part to Android Phone.
* Android phone also generates a pair of ECDH key and exchanges the public part with the device.
* Both of them will then use their own private key and the other's public to count a secret.
* The exchange process will be successfully ended only if the secrets are the same.