Skip to content

Instantly share code, notes, and snippets.

View muloka's full-sized avatar
💖
I may be slow to respond.

Muloka muloka

💖
I may be slow to respond.
View GitHub Profile
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
# vagrant.yml
- hosts: all
user: vagrant
sudo: True
tasks:
- name: Update APT package cache
apt: update_cache=yes
- name: Upgrade APT packages
apt: upgrade=yes
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
@muloka
muloka / Preferences.sublime-settings.js
Last active December 11, 2015 10:48
Sublime Settings / Preferences
{
"caret_style": "phase",
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"detect_indentation": false,
"detect_slow_plugins": false,
"folder_exclude_patterns":
[
".sass-cache",
".git",
".hg",
<cfscript>
function stripQuotes(str) {
var regex = '^"(.+)"$';
var pattern = createObject("java", "java.util.regex.Pattern");
var matcher = pattern.compile(regex).matcher(str);
return matcher.replaceAll("$1");
}
</cfscript>
SELECT stuff FROM [Product] p
JOIN [category] c ON
-- collating on the fly #FTW
c.[Name] COLLATE SQL_Latin1_General_CP1_CI_AS = p.[Name] COLLATE SQL_Latin1_General_CP1_CI_AS
require 'formula'
class YoutubeDl <ScriptFileFormula
url 'https://github.com/phihag/youtube-dl/raw/master/youtube-dl'
homepage 'http://rg3.github.com/youtube-dl/'
md5 'a5b92351e8cfa663c888e7d24116477e'
version '2011.08.24-phihag'
end
info it worked if it ends with ok
verbose cli [ 'node',
verbose cli '/Users/muloka/src/npm/cli.js',
verbose cli 'install',
verbose cli '-g',
verbose cli '-f' ]
info using npm@1.0.26
info using node@v0.5.5-pre
verbose config file /Users/muloka/.npmrc
verbose config file /Users/muloka/local/node/etc/npmrc
// saw this on Forrst, forget who posted it though
$('[href$="pdf"],.pdf').live("click", function(){
// get the link attribute and find the filename of the PDF
var pdfLink = $(this).attr("href"),
pdfLocation = pdfLink.substr(pdfLink.lastIndexOf("/")).replace("/","");
_gaq.push(['_trackPageview', pdfLocation]);
});
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
String.prototype.isNumber = function() {
return typeof parseFloat(this, 10) === 'number' && isFinite(this) && this.trim().length > 0;
};