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
// You can specify single files: | |
{src: 'foo/this.js', dest: ...} | |
// Or arrays of files: | |
{src: ['foo/this.js', 'foo/that.js', 'foo/the-other.js'], dest: ...} | |
// Or you can generalize with a glob pattern: | |
{src: 'foo/th*.js', dest: ...} | |
// This single node-glob pattern: | |
{src: 'foo/{a,b}*.js', dest: ...} | |
// Could also be written like this: |
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
function SomeObject() { | |
var self = this; | |
this.lastExecThrottle = 500; // limit to one call every "n" msec | |
this.lastExec = new Date(); | |
this.timer = null; | |
this.resizeHandler = function() { | |
var d = new Date(); | |
if (d-self.lastExec < self.lastExecThrottle) { | |
// This function has been called "too soon," before the allowed "rate" of twice per second | |
// Set (or reset) timer so the throttled handler execution happens "n" msec from now instead |
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
#a/usr/bin/perl | |
# This script was hastily cobbled together for my own use. It can | |
# probably break your system. Use at your own risk. | |
$JAIL = "/srv/http"; | |
$USER = "http"; | |
$GROUP = "http"; | |
$WWW_DIR = "www"; | |
sub run{ |
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
<!-- Latest compiled and minified CSS --> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"> | |
<!-- Optional theme --> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css"> | |
<!-- Latest compiled and minified JavaScript --> | |
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> |
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 | |
/* | |
* Converts CSV to JSON | |
* Example uses Google Spreadsheet CSV feed | |
* csvToArray function I think I found on php.net | |
*/ | |
/* | |
* Using of script in command line: | |
* ./csv-to-json.php csv.file.name.or.url > json.file.name |
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
<?php | |
/* | |
* Converts CSV to JSON | |
* Example uses Google Spreadsheet CSV feed | |
* csvToArray function I think I found on php.net | |
*/ | |
header('Content-type: application/json'); | |
// Set your CSV feed |
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
#Find out, which device is bound to the driver: | |
find /sys/bus/pci/drivers/mei_me/ -type l|sed 's#^.*/##' | |
0000:00:03.0 | |
#Now unbind (as root): | |
echo 0000:00:03.0 > /sys/bus/pci/drivers/mei_me/unbind | |
#…and your next resume will work better. |
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/env bash | |
# Runs a command wrapped with btrfs pre-post snapshots. | |
log_path="/var/local/log/snp" | |
date=$(date "+%Y-%m-%d-%H%M%S") | |
log_file="${log_path}/snp_${date}.log" | |
# Log stdout and stderr. Reference: http://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself | |
exec > >(tee -a "$log_file") | |
exec 2> >(tee -a "$log_file" >&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
#!/bin/bash -ex | |
# Paste this into ssh | |
# curl -sL https://gist.github.com/gists/2913223/download | tar -xzO | /bin/bash -ex | |
# When forking, you can get the URL from the download button. | |
pushd $HOME | |
aptget='sudo apt-get' | |
chsh='sudo chsh' |
NewerOlder