most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
{ | |
"use_simple_full_screen": false, | |
// calculates indentation automatically when pressing enter | |
"auto_indent": true, | |
// sets the colors used within the text area (default) | |
// see https://github.com/olivierlacan/monokaim to download | |
// the customized Monokai I use. | |
"color_scheme": "Packages/Color Scheme - Default/Monokaim.tmTheme", |
def ping(server, port): | |
''' Check if a server accepts connections on a specific TCP port ''' | |
try: | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((server, port)) | |
s.close() | |
return True | |
except socket.error: | |
return False |
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 ); | |
function woocommerce_category_image() { | |
if ( is_product_category() ){ | |
global $wp_query; | |
$cat = $wp_query->get_queried_object(); | |
$thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); | |
$image = wp_get_attachment_url( $thumbnail_id ); | |
if ( $image ) { | |
echo '<img src="' . $image . '" alt="' . $cat->name . '" />'; | |
} |
介紹協助提昇 F2E Code Style 的兩個工具。
josephj@faria
sudo apt-get install jpegoptim optipng | |
find . -type f -name "*.jpg" -exec jpegoptim {} \; | |
find . -type f -name "*.png" -exec optipng {} \; | |
find . -type f -name "*.jpeg" -exec jpegoptim {} \; | |
--- | |
sudo apt-get install imagemagick | |
find . -type f -size +1000k -name "*.jpg" -exec convert {} -resize "2048>x2048>" {} \; | |
find . -type f -size +1000k -name "*.jpeg" -exec convert {} -resize "2048>x2048>" {} \; | |
find . -type f -size +1000k -name "*.png" -exec convert {} -resize "2048>x2048>" {} \; |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redmine | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Starts redmine with puma | |
# Description: Starts redmine from /home/redmine/redmine. | |
### END INIT INFO |
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Sharing Laravel's session and checking authentication | |
|-------------------------------------------------------------------------- | |
| | |
| Use the following code in any CMS (WordPress, Joomla, etc), filemanager (CKFinder, | |
| KCFinder, simogeos's Filemanager, etc), or any other non-Laravel project to boot into | |
| the Laravel framework, with session support, and check if the user is authenticated. |
# get startup.sh from gist | |
wget https://gist.githubusercontent.com/shengyou/644b1ac28fa05e34146369e4bda53176/raw/06028bf9e9870aaed0085261bdbdbcc91a6b0128/startup.sh | |
# run startup script | |
bash startup.sh | |
# generate ssh key | |
ssh-keygen -t rsa -b 4096 -C "{your email}" | |
# clone your app |