Skip to content

Instantly share code, notes, and snippets.

View HamGuy's full-sized avatar
🎯
Focusing

HamGuy HamGuy

🎯
Focusing
View GitHub Profile
@HamGuy
HamGuy / batch_sam.py
Created July 9, 2023 08:05 — forked from LukeAI/batch_sam.py
How to process a dir of images with SAM and save visualisations of their masks
#!/usr/bin/env python
from __future__ import annotations
import os
from pathlib import Path
from segment_anything import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
import cv2
import numpy as np
import torch
from tqdm import tqdm
@HamGuy
HamGuy / UINavigationBarBackButtonHandler.swift
Last active October 10, 2021 01:05
extension allows to handle UINavigationViewController's 'Back' button action, migrate from https://github.com/onegray/UIViewController-BackButtonHandler
//
// UINavigationBarBackButtonHandler.swift
// Demo
//
// Created by HamGuy on 20/04/2017.
// Copyright © 2017 hamguy.net. All rights reserved.
//
import Foundation
@HamGuy
HamGuy / docker-compose.yml
Created July 17, 2019 02:16
docker compose configure for sonaqube
version: '3'
services:
#SonarQube Container
sonarqube:
image: sonarqube:6.7-community
container_name: sonarqube
ports:
- "9000:9000"
links:
- postgres
@HamGuy
HamGuy / HGLabel.h
Created April 17, 2019 10:43
HGLabel
//
// HGLabel.h
//
// Created by HamGuy on 2019/4/17.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@HamGuy
HamGuy / TapableLabel.swift
Last active November 21, 2018 08:03
Subclass of UILabel could handle navigation when touch link
//
// TapableLabel.swift
// AspirinUIKit
//
// Created by HamGuy on 2018/11/21.
//
import UIKit
public protocol TapableLabelDelegate: NSObjectProtocol {
@HamGuy
HamGuy / steppedSlider.swift
Created May 23, 2018 05:43 — forked from cumanzor/steppedSlider.swift
stepped UISlider.
let step: Float = 50;
// extra slider initialization. the IBAction func below points to the UISlider we are using.
@IBAction func onStrengthChange(sender: UISlider) {
let roundedValue = round(sender.value/step) * step
sender.value = roundedValue
}
@HamGuy
HamGuy / git.md
Created April 2, 2014 03:23 — forked from suziewong/git.md

github的多人协作

  1. github上你可以用别人的现成的代码 直接 git clone 即可了

  2. 然后你也想改代码或者贡献代码咋办?

Fork

@HamGuy
HamGuy / file_path_test.sh
Created April 4, 2018 02:53 — forked from feng-ming/file_path_test.sh
unix shell 判断目录/文件是否存在, 以及是否有读写权限。
shell判断文件,目录是否存在或者具有权限
#!/bin/sh
Path="/var/log/httpd/"
File="/var/log/httpd/access.log"
#这里的-x 参数判断$Path是否存在并且是否具有可执行权限
if [ ! -x "$Path"]; then
mkdir "$Path"
fi
//
// DZNEmptyDataSet.swift
// Sample
//
// Created by Ignacio Romero on 12/18/15.
// Copyright © 2015 DZN Labs. All rights reserved.
//
import UIKit
fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
@HamGuy
HamGuy / AutiEventTest.cpp
Created August 28, 2013 03:35
Win32下多线程同步技术
#include <iostream>
#include <windows.h>
#include <process.h>
int g_Count;
const int THREAD_NUM =10;
CRITICAL_SECTION g_csSubThread;
HANDLE g_Event;
unsigned int __stdcall ThreadFunc(PVOID pM)