This file contains hidden or 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
var urlParams = {}; | |
(function () { | |
var e, | |
r = /([^&=]+)=?([^&]*)/g, | |
d = function (s) { return decodeURIComponent(unescape(s)); }, | |
q = window.location.search.substring(1); | |
while (e = r.exec(q)) | |
urlParams[d(e[1])] = d(e[2]); | |
})(); |
This file contains hidden or 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
SELECT * | |
FROM ( | |
SELECT @cnt := COUNT(*) + 1, | |
@lim := 10 | |
FROM t_random | |
) vars | |
STRAIGHT_JOIN | |
( | |
SELECT r.*, | |
@lim := @lim - 1 |
This file contains hidden or 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
CREATE TABLE `some_table` ( | |
`id` int(4) unsigned NOT NULL AUTO_INCREMENT, | |
`value` varchar(255) NOT NULL DEFAULT '', | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `value` (`value`) | |
); | |
INSERT INTO some_table (value) VALUES ('test') ON DUPLICATE KEY UPDATE id = LAST_INSERT_ID(id); | |
select last_insert_id(); |
This file contains hidden or 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/php | |
<?php | |
date_default_timezone_set('UTC'); | |
/** | |
* oAuth settings from http://dev.netatmo.com/dev/listapps | |
*/ | |
define('APP_ID', ''); | |
define('APP_SECRET', ''); | |
define('USERNAME', ''); | |
define('PASSWORD', ''); |
This file contains hidden or 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
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.image.BufferedImage; | |
public class pxs extends JFrame { | |
private static final long SLEEP_DELAY = 500L; | |
private static JLabel label; | |
public static void main(String[] args) { | |
JFrame frame = new pxs(); |
This file contains hidden or 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 | |
for f in *.css; do | |
grep -ioE "(url\(|src=)['\"]?[^)'\"]*" $f | grep -ioE "[^\"'(]*.\.(woff)" | while read l ; do | |
sed -i "s>$l>data:font/${l/[^.]*./};base64,`openssl enc -base64 -in $l| tr -d '\n'`>" $f ; | |
done; | |
done; |
This file contains hidden or 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 | |
# Script that checks whether lighttpd is still up, and if not: | |
# - e-mail the last bit of log files | |
# - kick some life back into it | |
# -- Thomas, 20050606 | |
PATH=/bin:/usr/bin | |
THEDIR=/tmp/lighttpd-watchdog | |
EMAIL= | |
PATH= |
This file contains hidden or 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
export PATH=/usr/local/bin:/usr/local/sbin:$PATH | |
[ -z "$PS1" ] && return | |
export TERM=xterm-color | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
#export PS1="\h:\W \u\$" | |
#export PS1="[\u@\[\e[32;1m\]\H \[\e[0m\]\w]\$ " | |
#export PS1="\h:\[\e[32;1m\]\W\e[0m\] \$ " | |
#alias ll='ls -hl' |
This file contains hidden or 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
var page = require('webpage').create(), | |
address, output, size; | |
if (phantom.args.length < 2 || phantom.args.length > 3) { | |
console.log('Usage: rasterize.js URL filename'); | |
phantom.exit(); | |
} else { | |
address = phantom.args[0]; | |
output = phantom.args[1]; | |
page.viewportSize = { width: 1280, height: 1024 }; |
This file contains hidden or 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
var page = require('webpage').create(); | |
var system = require('system'); | |
var cur_date = new Date(); | |
var folder = cur_date.getFullYear() + '-' + (cur_date.getMonth()+1) + '-' + cur_date.getDate();// +'_'+ cur_date.getHours() +cur_date.getMinutes(); | |
var url = system.args[1]; | |
var filename = url.replace(/[^a-z0-9]/gi, '_').toLowerCase(); | |
page.open(url, function () { | |
page.render(folder+'/'+filename+'.png'); |
OlderNewer