This commit is contained in:
Rico Sta. Cruz 2013-01-08 16:37:25 +08:00
parent 6a11b57904
commit 1288ba807c
10 changed files with 228 additions and 45 deletions

View File

@ -147,3 +147,28 @@ Timestamp:
perl -p -i -e 's/hello/HELLO/g' **/*
## Grep
-A num # Print `num` lines of training context
-G # --basic-regexp (default)
-E # --extended-regexp
-P # --perl-regexp
-f file # --file (Get patterns for file)
-F # --fixed-strings
-h # --no-filename
-H # --with-filename
-l # --files-with-matches (just print filenames)
-L # --files-without-match
-r, -R # --recursive
-v # --invert-match
-i # --ignore-case
Synonyms:
egrep => grep -E
fgrep => grep -F

36
curl.md Normal file
View File

@ -0,0 +1,36 @@
title: Curl
---
Options:
-o <file> # --output: write to file
-u user:pass # --user: Authentication
-v # --verbose
-vv # Even more verbose
Data options:
-d <data> # --data: HTTP post data
-G # --get: send -d data via get
Headers:
-A <str> # --user-agent
SSL:
--cacert <file>
--capath <dir>
-E <cert> # --ecrt: Client cert file
--cert-type # der/pem/eng
## Examples
# Post data:
curl -d password=x http://x.com/y
# Auth/data:
curl -u user:pass -d status="Hello" http://twitter.com/statuses/update.xml

40
ec2.md
View File

@ -3,43 +3,43 @@ title: EC2 API tools
### Install
$ sudo apt-get install ec2-api-tools ec2-ami-tools # Ubuntu
$ brew install ec2-api-tools ec2-ami-tools # OSX/Homebrew
$ sudo apt-get install ec2-api-tools ec2-ami-tools
$ brew install ec2-api-tools ec2-ami-tools
### Key pair
To use public images (AMI's), you need an SSH keypair from EC2.
$ ec2-add-keypair my-keypair > ~/.ec2/my-keypair.pem
$ chmod 600 ec2-keypair.pem
# To use public images (AMI's), you need an SSH keypair from EC2.
ec2-add-keypair my-keypair > ~/.ec2/my-keypair.pem
chmod 600 ec2-keypair.pem
### Start an instance
# Show images (AMI's) owned by amazon, or me
$ ec2-describe-images -o self -o amazon
# Start an instance using a given AMI image:
# (Use the Ubuntu locator, or ec2-describe-images)
ec2-run-instances ami-xxxxxx -k ec2-keypair
# Start an instance using a given AMI image
$ ec2-run-instances ami-xxxxxx -k ec2-keypair
# Open up ports (in the 'default' security group):
ec2-authorize default -p 22
ec2-authorize default -p 80
# Open up ports (in the 'default' security group)
$ ec2-authorize default -p 22
$ ec2-authorize default -p 80
# Now SSH to it
$ ssh -i ~/.ec2/my-keypair.pem root@ec2-xxx.amazonaws.com
# Connect
ssh -i ~/.ec2/my-keypair.pem root@ec2-xxx.amazonaws.com
### Management
# Show running
$ ec2-describe-instances
# Show running instances
ec2-describe-instances
# Kill an instance
$ ec2-terminate-instances i-yourinstance
ec2-terminate-instances i-yourinstance
### Misc
# Create a security group
$ ec2-add-group group_name -d "Description"
ec2-add-group group_name -d "Description"
# Show images (AMI's) owned by amazon, or me
ec2-describe-images -o self -o amazon
### Ubuntu images

14
git.md Normal file
View File

@ -0,0 +1,14 @@
title: Git
--
## Submodules
# Import .gitmodules
git submodule init
# Clone missing submodules, and checkout commits
git submodule update --init --recursive
# Update remote URLs in .gitmodules
# (Use when you changed remotes in submodules)
git submodule sync

42
html.md
View File

@ -9,9 +9,9 @@ title: HTML
### iPhone viewport
<meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/> <!-- full example -->
<meta name="viewport" content="width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <!-- full example -->
### Default OpenGraph meta tags
@ -25,24 +25,24 @@ title: HTML
### Webfonts
<script>WebFontConfig={ },function(a,b){var c=a.createElement(b);c.src="//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js",c.async=1;var d=a.getElementsByTagName(b)[0];d.parentNode.insertBefore(c,d)}(document,"script")</script>
<script>WebFontConfig={ },function(a,b){var c=a.createElement(b);c.src="//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js",c.async=1;var d=a.getElementsByTagName(b)[0];d.parentNode.insertBefore(c,d)}(document,"script")</script>
// {typekit{id:"..."}}
// {google:{families:['Exo:400']}}
// {typekit{id:"..."}}
// {google:{families:['Exo:400']}}
### Google Analytics
<script>location.hostname.match(/helloworld\.com/)&&(_gaq=[["_setAccount","UA-XXXXX-1"],["_trackPageview"]],function(a,b){var c=a.createElement(b),d=a.getElementsByTagName(b)[0];c.async=1,c.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js",d.parentNode.insertBefore(c,d)}(document,"script"))</script>
<script>location.hostname.match(/helloworld\.com/)&&(_gaq=[["_setAccount","UA-XXXXX-1"],["_trackPageview"]],function(a,b){var c=a.createElement(b),d=a.getElementsByTagName(b)[0];c.async=1,c.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js",d.parentNode.insertBefore(c,d)}(document,"script"))</script>
### FB/Twitter
<div id="fb-root"></div><script>fbAsyncInit=function(){FB.init({"appId":"___APPIDGOESHERE___","status":true,"cookie":true,"xfbml":true})};!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src='//connect.facebook.net/en_US/all.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','facebook-jssdk');</script>
<div id="fb-root"></div><script>fbAsyncInit=function(){FB.init({"appId":"___APPIDGOESHERE___","status":true,"cookie":true,"xfbml":true})};!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src='//connect.facebook.net/en_US/all.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','facebook-jssdk');</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=1;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
### HTML5 Shiv for IE8
<!--[if lte IE 8]><script src='//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js'></script><![endif]-->
<!--[if lte IE 8]><script src='//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js'></script><![endif]-->
### H5BP HTML tag (IE8 and IE9 only)
@ -51,11 +51,11 @@ title: HTML
### Touch icons
apple-touch-icon-precomposed.png
apple-touch-icon-57x57-precomposed.png
apple-touch-icon-72x72-precomposed.png
apple-touch-icon-114x114-precomposed.png
apple-touch-icon-144x144-precomposed.png
* apple-touch-icon-precomposed.png
* apple-touch-icon-57x57-precomposed.png
* apple-touch-icon-72x72-precomposed.png
* apple-touch-icon-114x114-precomposed.png
* apple-touch-icon-144x144-precomposed.png
### Icons
@ -76,14 +76,6 @@ Only do this if you're not placing the site in the root!
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
### IE conditionals
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
### Google jQuery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
@ -104,3 +96,9 @@ Only do this if you're not placing the site in the root!
</span>
</div>
<![endif]-->
### HTML Compatiblity inspector
<script src="http://ie.microsoft.com/testdrive/HTML5/CompatInspector/inspector.js"></script>
More info here: [microsoft.com](http://ie.microsoft.com/testdrive/HTML5/CompatInspector/)

8
ie.md
View File

@ -17,7 +17,7 @@ CSS properties:
## Only available in IE8+
Selectors/pseudos: ([polyfill][selectivizr])
Selectors/pseudos: ([polyfill: selectivizr][selectivizr])
- `+` _(adjacent)_
- `:first-child` _(unless for static elements)_
@ -46,7 +46,7 @@ JS features:
## Only available in IE9+
Selectors/pseudos: ([polyfill][selectivizr])
Selectors/pseudos: ([polyfill: selectivizr][selectivizr])
- `:first-of-type`, `:last-of-type`
- `:last-child`
@ -73,7 +73,7 @@ CSS properties:
CSS features:
- `@media` queries
- `@media` queries ([polyfill: respond.js][respond])
HTML5 features:
@ -111,6 +111,7 @@ Always install these in almost every project:
- [selectivizr] for selectors
- [html5shiv] for new HTML tags
- [json2] for JSON parsing (IE7 below)
- [respond] for media queries
You may also need these:
@ -156,3 +157,4 @@ Misc
[json2]: https://github.com/douglascrockford/JSON-js
[modernizr]: https://modernizr.com
[ecsstender]: http://ecsstender.org/
[respond]: https://github.com/scottjehl/Respond

58
modernizr.md Normal file
View File

@ -0,0 +1,58 @@
title: Modernizr
### Script
<script src='//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js'></script>
### Detections
JavaScript
* js
CSS
* flexbox
* rgba
* hsla
* multiplebgs
* backgroundsize
* borderimage
* borderradius
* boxshadow
* textshadow
* opacity
* cssanimations
* csscolumns
* cssgradients
* cssreflections
* csstransforms
* csstransforms3d
* csstransitions
* fontface
* generatedcontent
HTML5
* canvas
* canvastext
* webgl
* touch
* geolocation
* postmessage
* websqldatabase
* indexeddb
* hashchange
* history
* draganddrop
* websockets
* video
* audio
* localstorage
* sessionstorage
* webworkers
* applicationcache
* svg
* inlinesvg
* smil
* svgclippaths

22
rename.md Normal file
View File

@ -0,0 +1,22 @@
title: rename
---
### Installation
# http://plasmasturm.org/code/rename/
brew install rename
### Examples
# Rename hello.txt to world.txt and so on
rename 's/hello/world/' *.txt
# Search and replace
rename -s .png .jpg.png *.png
### Options
-n # Simulation
-l # Symlink instead of rename
-i # Interactive

View File

@ -22,6 +22,21 @@ html
background: #505060 * 0.8
padding: 60px 20px
a
&, &:visited
background-color: mix(#db3, white, 30%)
color: #db3 * 0.6
text-shadow: 0 1px 1px rgba(white, 0.2)
padding: 1px 2px
box-shadow: 0 1px 1px rgba(black, 0.3)
border-radius: 2px
text-decoration: none
&:hover
background-color: mix(#db3, white, 50%)
@media screen and (max-width: 800px)
html
padding: 20px

13
znc.md
View File

@ -1,6 +1,19 @@
title: ZNC bouncer
---
## Start
/msg *status addserver irc.undernet.org [6667]
/msg *status connect
/msg *status loadmod webadmin
/msg *status loadmod admin
/msg *status loadmod away
/msg *status loadmod awaynick
/msg *status loadmod clientnotify # Notifies when another client logs
/msg *status loadmod keepnick
/msg *status loadmod kickrejoin
## Away
/msg *status loadmod away