This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# support sliding window maximum in linear time | |
srand(123) | |
n = 9 | |
k = 3 | |
m = n-1 | |
a = (0..m).to_a | |
for i in 0..m do | |
#a[i] = (rand()*10).floor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// allow product links w/o `product/` base for wc | |
// additionaly you can add | |
// RedirectMatch 301 ^/product/(.*)$ /$1 | |
// to `.htaccess` to handle `page?foo=bar` queries | |
// this script is based on this article by Ryan Sechrest: | |
// http://ryansechrest.com/2013/04/remove-post-type-slug-in-custom-post-type-url-and-move-subpages-to-website-root-in-wordpress/ | |
add_action( | |
'pre_get_posts', | |
'custom_pre_get_posts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CRITICAL=5 | |
bat_info=`acpi -b` | |
level=`echo $bat_info | grep -o [0-9]*% | sed s/%//` | |
#echo $level | |
if [ ! $level ] | |
then | |
exit | |
fi | |
discharging=`echo $bat_info | grep Discharging` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fileutils' | |
help = view = gen = apply = edit = del = restore = false | |
letters = '' | |
ARGV.each do |arg| | |
if arg[1] == '-' | |
help ||= arg == '--help' | |
view ||= arg == '--view' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$address = array( | |
'first_name' => $customer_name, | |
'last_name' => '', | |
'company' => '', | |
'email' => $customer_email, | |
'phone' => $customer_phone, | |
'address_1' => '', | |
'address_2' => '', | |
'city' => '', | |
'state' => '', |
NewerOlder