Skip to content

Instantly share code, notes, and snippets.

View yinsee's full-sized avatar

Yinsee yinsee

View GitHub Profile
@yinsee
yinsee / proxy.py
Created February 22, 2022 13:20
tcp proxy
import socket
import threading
import sys
def receive_from(connection):
buffer = b''
# first respond allow 2 second timeout
connection.settimeout(2)
@yinsee
yinsee / main.py
Last active December 29, 2021 22:05
barcode scanner python gui
from tkinter import *
import requests
import json
import serial
import pymodbus
from pymodbus.client.sync import ModbusSerialClient
barcode = ""
toggle = True
@yinsee
yinsee / swagger-to-laravel
Last active May 6, 2018 18:16
Swagger (JSON) to Laravel Migrations and Models
<?php
$prefix = 'OMS';
$namespace = 'App\\Models\\' . $prefix;
$swagger = json_decode(file_get_contents($argv[1]));
mkdir("gen");
mkdir("gen/models");
mkdir("gen/migrations");
foreach ($swagger->definitions as $class => $def) {
swagger: "2.0"
info:
version: "1.0"
title: "GPM Endpoints"
description: >
API follow the following conventions
- GET: Retrieval of an object
- POST: Upsert object
@yinsee
yinsee / complete.html
Last active September 25, 2017 00:23
Poll demo
<p>
尊敬的先生/女士,我们要感谢您的参与。希望再次与您进行调查。
<br><br>
谢谢.<br>
项目经理<br>
</p>
@yinsee
yinsee / UIImage+Trim
Last active June 19, 2023 05:33
Trim whitespaces on UIImage
/*
http://stackoverflow.com/questions/9061800/how-do-i-autocrop-a-uiimage/40780523#40780523
*/
import UIKit
extension UIImage {
func trim() -> UIImage {
let newRect = self.cropRect