Remove inactive cheatsheets (#2131)
Remove some very old ones that may not be relevant anymore.
This commit is contained in:
parent
d138253d1e
commit
a7b5dbe1e7
|
@ -1,81 +0,0 @@
|
|||
---
|
||||
title: Ansible
|
||||
category: Ruby
|
||||
---
|
||||
|
||||
## Looping
|
||||
|
||||
### Array (with_items)
|
||||
|
||||
```yaml
|
||||
vars:
|
||||
security_groups:
|
||||
- name: 'hello'
|
||||
desc: 'world'
|
||||
|
||||
- name: 'hola'
|
||||
desc: 'mundo'
|
||||
|
||||
tasks:
|
||||
- name: Create required security groups
|
||||
ec2_group:
|
||||
name: "{{ item.name }}"
|
||||
description: "{{ item.desc }}"
|
||||
with_items: "{{ security_groups }}"
|
||||
```
|
||||
|
||||
### Object (with_dict)
|
||||
|
||||
```yaml
|
||||
tasks:
|
||||
- name: Print phone records
|
||||
debug: msg="User {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})"
|
||||
with_dict: "{{ users }}"
|
||||
```
|
||||
|
||||
## with_file
|
||||
|
||||
```yaml
|
||||
- name: "Send key"
|
||||
ec2_key:
|
||||
key_material: "{{ item }}"
|
||||
with_file: ./keys/sshkey.pub
|
||||
|
||||
# or
|
||||
with_fileglob: ./keys/*.pub
|
||||
```
|
||||
|
||||
### Conditionals
|
||||
|
||||
```yml
|
||||
- include: setup-debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
when: (ansible_distribution == "CentOS" and ansible_distribution_major_version == "6") or
|
||||
(ansible_distribution == "Debian" and ansible_distribution_major_version == "7")
|
||||
|
||||
|
||||
# Just like "and"
|
||||
when:
|
||||
- ansible_distribution == "CentOS"
|
||||
- ansible_distribution_major_version == "6"
|
||||
```
|
||||
|
||||
## Expressions
|
||||
|
||||
```
|
||||
{{ item }}
|
||||
{{ item.name }}
|
||||
{{ item[0].name }}
|
||||
|
||||
{{ item | default('latest') }}
|
||||
```
|
||||
|
||||
## Includes
|
||||
|
||||
```
|
||||
tasks:
|
||||
- include: wordpress.yml
|
||||
vars:
|
||||
wp_user: timmy
|
||||
```
|
|
@ -1,78 +0,0 @@
|
|||
# Installing
|
||||
wget "http://kohanaphp.com/download?modules%5Bauth%5D=Auth&languages%5Ben_US%5D=en_US&format=zip" -O k.zip &&\
|
||||
unzip -q k.zip && rm k.zip &&\
|
||||
mv Kohana_*/* . && rm -rf Kohana_* &&\
|
||||
rm -f "Kohana License.html" &&\
|
||||
# htaccess
|
||||
cat example.htaccess | sed 's/RewriteBase .*/RewriteBase \//g' > .htaccess && rm example.htaccess &&\
|
||||
echo Done! Go and edit application/config/config.php and change the site stuff.
|
||||
|
||||
# Public HTML
|
||||
mkdir -p public_html &&\
|
||||
mv index.html public_html &&\
|
||||
mv .htaccess public_html &&\
|
||||
echo Done. Now edit index.html's paths
|
||||
|
||||
Git ignore
|
||||
(echo \*.swo; echo \*.swp; echo .DS_Store; echo Thumbs.db; echo \*~; echo application/logs; echo application/cache ) > .gitignore &&\
|
||||
|
||||
# Database
|
||||
$config['default'] = array
|
||||
(
|
||||
'benchmark' => TRUE,
|
||||
'persistent' => FALSE,
|
||||
'connection' => array
|
||||
(
|
||||
'type' => 'mysql',
|
||||
'user' => 'leet', // set to db user name
|
||||
'pass' => 'l33t', // set to db user password
|
||||
'host' => 'localhost',
|
||||
'port' => FALSE,
|
||||
'socket' => FALSE,
|
||||
'database' => 'leetdb' // set to db name
|
||||
),
|
||||
'character_set' => 'utf8',
|
||||
'table_prefix' => '',
|
||||
'object' => TRUE,
|
||||
'cache' => FALSE,
|
||||
'escape' => TRUE
|
||||
);
|
||||
|
||||
|
||||
// ORM model
|
||||
class Post_Model extends ORM {
|
||||
protected $has_one = array('user'); // has_many, belong_to, has_one, has_and_belongs_to_many
|
||||
}
|
||||
|
||||
// ORM
|
||||
$post = ORM::factory('post', 1);
|
||||
$post->name = "Post name";
|
||||
$post->save();
|
||||
foreach ($post->categories as $category)
|
||||
{
|
||||
echo $category->name;
|
||||
}
|
||||
|
||||
// Find (returns even if no row is found)
|
||||
$o = ORM::factory('article')->find(1);
|
||||
$o = ORM::factory('article')->where('title', $title)->find();
|
||||
if (!$o->loaded) { die('Not found'); }
|
||||
echo $o->title;
|
||||
|
||||
// Find_all
|
||||
$o = ORM::factory('article')->find_all();
|
||||
foreach ($o as $article) { echo $article->title; }
|
||||
|
||||
// ->$saved
|
||||
// ->$changed[]
|
||||
// ->$object_name (Blog_Post_Model => "blog_post")
|
||||
// ->$primary_key ('id')
|
||||
// ->$primary_val ('username') - more userfriendly identifier
|
||||
// ->$table_name
|
||||
// ->$ignored_columns = array('whatever')
|
||||
// ->$table_columns = array('id', 'username')
|
||||
// ->$sorting = array('last_login' => 'desc') -- default sorting
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
# Debug
|
||||
logger.debug "xx"
|
||||
|
||||
# Controller stuff
|
||||
class MyController < ApplicationController::Base
|
||||
controller.response.body
|
||||
|
||||
# Filters
|
||||
before_filter :require_login # Looks for require_login method
|
||||
before_filter MyFilter # Looks for MyFilter class
|
||||
before_filter { |ct| head(400) if ct.params["stop_action"] }
|
||||
around_filter :catch_exceptions
|
||||
after_filter :xx
|
||||
|
||||
layout "admin_area" # Looks for the view file
|
||||
layout "admin_area", :except => [ :rss, :whatever ]
|
||||
layout :foo # Looks for private function foo
|
||||
|
||||
private
|
||||
def whatever ...
|
||||
|
||||
class MyFilter
|
||||
def self.filter(controller, &block)
|
||||
|
||||
# Model
|
||||
|
||||
belongs_to :user
|
||||
validates_presence_of :user
|
||||
default_scope :order => 'id DESC'
|
||||
named_scope :today, :conditions = "created_at x"
|
||||
named_scope :today, lambda {{ :conditions = [ "created_at between ? and ?", 1.hour.ago.utc, 300.seconds.ago.utc ] }}
|
||||
# Then you can call feed.today
|
||||
|
||||
# Controller methods
|
||||
render :action => 'help', :layout => 'help'
|
||||
render :text => 'so and so'
|
||||
render :status => :created, :location => post_url(post) # With HTTP headers
|
||||
redirect_to :action => 'index'
|
||||
render :partial => 'product', :collection => @products, :as => :item, :spacer_template => "product_ruler"
|
||||
return head(:method_not_allowed)
|
||||
head :created, :location => '...'
|
||||
|
||||
url_for :controller => 'posts', :action => 'recent'
|
||||
|
||||
location = request.env["SERVER_ADDR"]
|
||||
|
||||
# For views
|
||||
auto_discovery_link_tag(:rss, {:action => "feed"}, {:title => "RSS Feed"})
|
||||
javascript_include_tag "foo"
|
||||
stylesheet_link_tag
|
||||
image_tag
|
||||
|
||||
# Ruby stuff!
|
||||
# Defining a class method (not a typo)
|
||||
Fixnum.instance_eval { def ten; 10; end }
|
||||
Fixnum.ten # => 10
|
||||
|
||||
# Defining an instance method
|
||||
Fixnum.class_eval { def number; self; end }
|
||||
7.number #=> 7
|
||||
|
||||
# Multiple arguments, send()
|
||||
class Klass
|
||||
def hello(*args); "Hello " + args.join(' '); end
|
||||
end
|
||||
Klass.new.send :hello, "gentle", "readers"
|
||||
|
||||
def can(*args)
|
||||
yield if can?(*args)
|
||||
end
|
||||
# can(x) {...} => if can?(x) {...}
|
||||
|
||||
|
||||
|
||||
# Struct
|
||||
class Foo < Struct.new(:name, :email)
|
||||
end
|
||||
|
||||
j = Foo.new("Jason", "jason@bateman.com")
|
||||
j.name = "Hi"
|
||||
print j.name
|
||||
|
||||
|
||||
# Struct
|
||||
class Foo < Struct.new(:name, :email)
|
||||
end
|
||||
|
||||
j = Foo.new("Jason", "jason@bateman.com")
|
||||
j.name = "Hi"
|
||||
print j.name
|
||||
|
||||
|
||||
# Method missing
|
||||
def method_missing(method_name, *arguments)
|
||||
if method_name.to_s[-1,1] == "?"
|
||||
self == method_name.to_s[0..-2]
|
||||
|
||||
|
||||
# Rails logger
|
||||
Rails.logger.info("...")
|
||||
|
||||
# To string
|
||||
:hello_there.to_s
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
title: Cinema4d
|
||||
category: Apps
|
||||
---
|
||||
|
||||
E R T : Move/rotate/scale
|
||||
P : snapping
|
|
@ -1,56 +0,0 @@
|
|||
---
|
||||
title: Compass sprites
|
||||
---
|
||||
|
||||
### Compass: Sprites
|
||||
|
||||
@import compass/utilities/sprites
|
||||
|
||||
$sprites: sprite-map('sprites/*.png')
|
||||
$sprites: sprite-map('sprites/*.png', $spacing: 20px)
|
||||
|
||||
@mixin sprite($name)
|
||||
background-image: sprite-url($sprite)
|
||||
|
||||
+sprite-dimensions($sprite, $name)
|
||||
width: image-width(sprite-file($sprite, $name)
|
||||
height: image-height(sprite-file($sprite, $name)
|
||||
|
||||
+sprite-background-position($sprite, $name[, $offset-x, $offset-y])
|
||||
background-position: sprite-position($sprite, $name)
|
||||
nth(sprite-position($sprite, $name), 1) # X position
|
||||
nth(sprite-position($sprite, $name), 2) # Y position
|
||||
|
||||
### Compass: Sprites (the @import way)
|
||||
|
||||
// Sprite sets (applies to icon/*.png)
|
||||
$icon-spacing: 0
|
||||
$icon-dimensions: true
|
||||
$icon-repeat: no-repeat
|
||||
$icon-position: 0
|
||||
|
||||
// Individual (applies to icon/mail.png)
|
||||
$icon-mail-spacing: 0
|
||||
|
||||
@import 'icon/*.png'
|
||||
@include all-icon-sprites
|
||||
|
||||
// Usage
|
||||
.image1
|
||||
@extend .icon-mail
|
||||
|
||||
.image2
|
||||
@extend .icon-refresh;
|
||||
|
||||
// ### Advanced control
|
||||
// The sprite map is available as $icon-sprites. You can then use
|
||||
// `sprite()` on it.
|
||||
|
||||
.image3
|
||||
background: sprite($icon-sprites, refresh)
|
||||
//background: url(...) 0 -16px;
|
||||
|
||||
.image3-with-offset
|
||||
background: sprite($icon-sprites, refresh, -2px, -9px)
|
||||
//background: url(...) -2px -19px;
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
title: Docker on OSX
|
||||
category: Devops
|
||||
---
|
||||
|
||||
You'll need these:
|
||||
|
||||
* [boot2docker] - bootstraps a Virtualbox VM to run a docker daemon
|
||||
* [docker] - docker client
|
||||
|
||||
### Install
|
||||
|
||||
$ brew install boot2docker
|
||||
$ brew install docker
|
||||
$ boot2docker init
|
||||
|
||||
### Turning on
|
||||
|
||||
$ boot2docker start
|
||||
|
||||
Waiting for VM to be started...... Started.
|
||||
To connect the Docker client to the Docker daemon, please set:
|
||||
|
||||
export DOCKER_HOST=tcp://192.168.59.103:2375
|
||||
|
||||
$ export DOCKER_HOST=tcp://192.168.59.103:2375
|
||||
|
||||
### Try it
|
||||
|
||||
$ docker search ubuntu
|
||||
|
||||
$ docker pull ubuntu
|
||||
$ docker start ubuntu
|
||||
|
||||
### Turning off
|
||||
|
||||
$ boot2docker save
|
||||
# save state to disk
|
||||
|
||||
### Vagrant
|
||||
|
||||
[boot2docker]: https://github.com/boot2docker/boot2docker
|
||||
[docker]: https://www.docker.com/
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
title: eslint
|
||||
category: JavaScript libraries
|
||||
---
|
||||
|
||||
```js
|
||||
// "comma-dangle": "always" ("always-multiline", "never")
|
||||
var foo = {
|
||||
bar: "baz",
|
||||
qux: "quux",
|
||||
};
|
||||
var arr = [1,2,];
|
||||
```
|
||||
|
||||
```
|
||||
// "yoda": "always" ("never")
|
||||
if ("red" === color)
|
||||
```
|
|
@ -1,9 +0,0 @@
|
|||
---
|
||||
title: GitHub
|
||||
category: Git
|
||||
---
|
||||
|
||||
### URLs
|
||||
|
||||
github.com/:userrepo/blame/:branch/:path
|
||||
github.com/:userrepo/commit/:commit
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
title: jQuery mobile events
|
||||
category: JavaScript libraries
|
||||
---
|
||||
|
||||
### Mobile events
|
||||
|
||||
For support for `tap`, `swipe`, `swipeLeft`, et al, use
|
||||
[jquery.mobile.event.js][m]. Be sure to set `$.support.touch` first.
|
||||
|
||||
To get `$.support.touch` (and family), use this from
|
||||
[jquery.mobile.support.js][s]:
|
||||
|
||||
$.extend($.support, {
|
||||
orientation: "orientation" in window && "onorientationchange" in window,
|
||||
touch: "ontouchend" in document,
|
||||
cssTransitions: "WebKitTransitionEvent" in window,
|
||||
pushState: "pushState" in history && "replaceState" in history,
|
||||
mediaquery: $.mobile.media( "only all" ),
|
||||
cssPseudoElement: !!propExists( "content" ),
|
||||
touchOverflow: !!propExists( "overflowScrolling" ),
|
||||
boxShadow: !!propExists( "boxShadow" ) && !bb,
|
||||
scrollTop: ( "pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[ 0 ] ) && !webos && !operamini,
|
||||
dynamicBaseTag: baseTagTest()
|
||||
});
|
||||
|
||||
[m]:https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.event.js
|
||||
[s]:https://github.com/jquery/jquery-mobile/blob/master/js/jquery.mobile.support.js
|
|
@ -1,32 +0,0 @@
|
|||
---
|
||||
title: node-gh
|
||||
category: JavaScript libraries
|
||||
---
|
||||
|
||||
## Everywhere
|
||||
|
||||
| Flag | Description |
|
||||
| ---- | ---- |
|
||||
| `-u rstacruz -r nprogress` | Repo name |
|
||||
| `--browser` | Browser |
|
||||
{:.no-head}
|
||||
|
||||
## Notifications
|
||||
|
||||
```
|
||||
gh nt
|
||||
gh nt --watch
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
| Command | Description |
|
||||
| ---- | ---- |
|
||||
| `gh is 'Issue name'` | Create issue |
|
||||
| `gh is --search 'foo'` | Search issues |
|
||||
| `gh is 'Name' 'Description'` | Create issue |
|
||||
| `gh is 123` | Modify issue `123` (use with flags below) |
|
||||
| ... `-L`/`--label x,y,z` | Add label |
|
||||
| ... `-A`/`--assignee` | Assign to user |
|
||||
| ... `-c`/`--comment 'Thanks'` | Add a comment
|
||||
{:.no-head}
|
|
@ -1,7 +0,0 @@
|
|||
---
|
||||
title: Git one-liners
|
||||
---
|
||||
|
||||
When did someone work
|
||||
|
||||
git log --all --author='Rico' --pretty="%ai" | awk '{ print $1 }' | sort | uniq
|
|
@ -1,26 +0,0 @@
|
|||
|
||||
### Encrypt decrypt
|
||||
|
||||
gpg --encrypt --recepient 'James Receiverson' foo.txt
|
||||
gpg --decrypt foo.txt.gpg
|
||||
|
||||
### Making keys
|
||||
|
||||
gpg --gen-key
|
||||
|
||||
### Share your public key
|
||||
|
||||
# via file
|
||||
gpg --armor --output pub.txt --export "Rico Sta. Cruz"
|
||||
|
||||
# via server
|
||||
gpg --send-keys "Rico Sta. Cruz" --keyserver http://...
|
||||
|
||||
### Key management
|
||||
|
||||
gpg --list-keys
|
||||
gpg --delete-key 'email@addie'
|
||||
|
||||
### See
|
||||
|
||||
* https://www.madboa.com/geek/gpg-quickstart/
|
|
@ -1,19 +0,0 @@
|
|||
---
|
||||
title: Homebrew formula
|
||||
---
|
||||
|
||||
brew create http://example.com/foo-0.1.tar.gz
|
||||
|
||||
https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md#formula-cookbook
|
||||
|
||||
assert(this.ary.indexOf(zero) === two)
|
||||
|
||||
|
||||
```
|
||||
def install
|
||||
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
|
||||
system "make", "install"
|
||||
cd "build/cmake"
|
||||
mv "a", "b"
|
||||
end
|
||||
```
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
title: iOS
|
||||
---
|
||||
|
||||
Multiple Exchange accounts:
|
||||
|
||||
scp root@iphone.local:/private/var/mobile/Library/Preferences/com.apple.accountsettings.plist .
|
||||
|
||||
Paths:
|
||||
|
||||
/Library/Themes # Winterboard themes
|
||||
/User/Media/DCIM/100APPLE # Photos
|
||||
/User/Media/Recordings # Voice recordings
|
||||
|
||||
Copy photos:
|
||||
|
||||
rsync -v -r root@iphone.local:/User/Media/DCIM/100APPLE ./photos
|
||||
|
||||
Ringtone conversion using ffmpeg:
|
||||
|
||||
ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r
|
Loading…
Reference in New Issue