Skip to content

Instantly share code, notes, and snippets.

@startuml
hide footbox
hide unlinked
'autonumber
skinparam style strictuml
skinparam {
shadowing false
backgroundColor #FEFEFE
'roundcorner 20
'maxmessagesize 60
@fengyie007
fengyie007 / python-mac-set-html-clipboard.py
Last active January 18, 2023 13:35 — forked from mpcabd/python-mac-set-html-clipboard.py
Python3 - Set Mac clipboard with HTML content
import subprocess
html = '<p><strong>Hello</strong> <em>Bob</em> <code>How</code> are you!</p>'
def setClipboardData(html):
# print(html)
p_hex = subprocess.Popen(
('hexdump', '-ve', '1/1 "%.2x"'),
stdin=subprocess.PIPE,
stdout=subprocess.PIPE
@fengyie007
fengyie007 / egos_throttle.sh
Created February 25, 2021 07:14 — forked from golimpio/egos_throttle.sh
Run cputhrottle for a list of applications in order to limit their CPU usage.
#!/bin/bash
# Run cputhrottle for a list of applications in order to limit their CPU usage.
# This script needs `pidof` and `cputhrottle` installed, which can be installed from homebrew.
# NOTE: This script was tested on MacOS only.
if [[ $EUID > 0 ]]; then
echo "Please run this script as root/sudo"
exit 1
fi
@fengyie007
fengyie007 / dabblet.css
Created July 14, 2014 05:06
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
<p style="border:1px solid red; width:200px; padding:20px;">
T
<span style="background-color:#C0C0C0; position:relative;">
这段文字从左向右排列,红 XX 和 蓝 XX 和黄 XX 都是绝对定位元素,它的包含块是相对定位的SPAN。 可以通过它们绝对定位的位置来判断它们包含块的边缘。
<em style="position:absolute; color:red; top:0; left:0;">XX</em>
<em style="position:absolute; color:yellow; top:20px; left:0;">XX</em>
<em style="position:absolute; color:blue; bottom:0; right:0;">XX</em>
</span>
</p>
@fengyie007
fengyie007 / dabblet.css
Created April 19, 2014 13:25
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
/*background: #f06;*/
/*background: linear-gradient(45deg, #f06, yellow);*/
min-height: 100%;
@fengyie007
fengyie007 / dabblet.css
Created April 19, 2014 13:00
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
/*background: #f06;*/
/*background: linear-gradient(45deg, #f06, yellow);*/
min-height: 100%;
@fengyie007
fengyie007 / maven-assembly-plugin-setting.xml
Last active December 28, 2015 23:08
maven-assembly-plugin setting
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<!--notappendassemblyidinreleasefilename-->
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assemble/package.xml</descriptor>
</descriptors>
</configuration>
<executions>
@fengyie007
fengyie007 / loadScript.js
Created November 21, 2013 04:47
Lazy load scripts
// JavaScript
function loadScript(src, callback) {
var head = document.getElementsByTagName('head')[0],
script = document.createElement('script');
done = false;
script.setAttribute('src', src);
script.setAttribute('type', 'text/javascript');
script.setAttribute('charset', 'utf-8');
script.onload = script.onreadstatechange = function() {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
@fengyie007
fengyie007 / LoggerFactory.java
Created November 21, 2013 04:45
LoggerFactory
import org.slf4j.Logger;
/**
* @author Hardy Ferentschik
*/
public final class LoggerFactory {
public static Logger make() {
Throwable t = new Throwable();
StackTraceElement directCaller = t.getStackTrace()[1];
return org.slf4j.LoggerFactory.getLogger(directCaller.getClassName());