Skip to content

Instantly share code, notes, and snippets.

View BluntBlade's full-sized avatar
🎯
Focusing

BluntBlade BluntBlade

🎯
Focusing
View GitHub Profile
@BluntBlade
BluntBlade / impbcopy.m
Created November 22, 2021 11:25 — forked from mwender/impbcopy.m
Command line copy an image file to the clipboard in Mac OS X. See first comment for install instructions.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
if([path isEqualToString:@"-"])
{
// http://caiustheory.com/read-standard-input-using-objective-c
def calculate_deadline(expires_in, deadline = nil)
### 授权期计算
if expires_in.is_a?(Integer) && expires_in > 0 then
# 指定相对时间,单位:秒
return Time.now.to_i + expires_in
elsif deadline.is_a?(Integer) then
# 指定绝对时间,常用于调试和单元测试
return deadline
end
@BluntBlade
BluntBlade / crc32 in bash
Last active December 2, 2020 01:55
A Bash version of CRC32
#!/bin/bash
##############################################################################
#
# Easy Qiniu Bash SDK
#
# www.qiniu.com
#
# Module: utils/crc32.sh
#
@BluntBlade
BluntBlade / hmac in bash
Created December 9, 2013 15:40
A Bash version of HMAC
#!/bin/bash
##############################################################################
#
# Easy Qiniu Bash SDK
#
# Module: utils/hmac.sh
#
# Author: LIANG Tao
# Weibo: @无锋之刃
@BluntBlade
BluntBlade / sha1 in bash
Last active December 30, 2015 16:29
A Bash version of SHA1
#!/bin/bash
##############################################################################
#
# Easy Qiniu Bash SDK
#
# Module: sha1.sh
#
# Author: LIANG Tao
# Weibo: @无锋之刃
@BluntBlade
BluntBlade / base64 in bash
Last active April 4, 2019 18:56
A Bash version of Base64.
#!/bin/bash
##############################################################################
#
# Easy Qiniu Bash SDK
#
# Module: base64.sh
#
# Author: LIANG Tao
# Weibo: @无锋之刃
@BluntBlade
BluntBlade / gist:5947489
Last active December 19, 2015 11:28
@七牛云存储 运维排班表模板
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>运维值班表</title>
<style>
<!--
table { text-align: center; width: 50em; border: 1px solid black; border-collapse: collapse; }
th,td { padding: 0.4em; border: 1px solid black; }