Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
@pije76
pije76 / gist:2147d0cc24020a6c555569b254a88f2b
Created May 24, 2017 20:26 — forked from sebsto/gist:9a958ff1c761b8c7c90d
Create IAM User and Attach a Policy using Boto and JSON
import json, boto
# Connect to IAM with boto
iam = boto.connect_iam(ACCESS_KEY, SECRET_KEY)
# Create user
user_response = iam.create_user('aws-user')
# Create Policy
policy = { 'Version' : '2012-10-17'}

Just some notes and references for myself.

  • In bash, you can access your C:\ drive via /mnt/c/
  • ~ = C:\Users\MLM\AppData\Local\lxss\home\mlm and is different from your Windows user directory C:\Users\MLM

How to google things

@pije76
pije76 / functions.php
Last active August 29, 2015 14:06 — forked from buchin/functions.php
function fb_change_search_url_rewrite() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
$keywords = get_query_var( 's' );
list($first_word) = explode(' ', trim($keywords));
wp_redirect( home_url( $first_word ) . urlencode( $keywords ) );
exit();
}
}
add_action( 'template_redirect', 'fb_change_search_url_rewrite' );
{% api %}{% image %}
{% for index, item in api%}
{% for imageindex, image in images %}
{% if index < 5 %}
{% if index == imageindex %}
<div class="entry clearfix">
<a href="{{ item.link }}" rel="nofollow" title="{{ item.title }}"><img src="{{ image.mediaurl }}" alt="{{ image.title }}"></a>
<h2 class="post-title"><a rel="nofollow" href="{{ item.link }}" title="{{ item.title }}">{{ item.title }}</a></h2>
@pije76
pije76 / video.html
Last active August 29, 2015 14:06 — forked from buchin/video.html
{% video %}
{% for index, v in videos %}
<iframe class="youtube-player" type="text/html" width="560" height="315" src="http://www.youtube.com/embed/{{ v.link | get_video_id }}" frameborder="0">
</iframe>
<p><img src="http://img.youtube.com/vi/{{ v.link | get_video_id }}/hqdefault.jpg" align="left"/>{{ v.title }}.
<br>
<strong>Download {{ v.title }}</strong>
<a href="http://keepvid.com/?url={{ v.link }}">MP4</a> |
<a href="http://keepvid.com/?url={{ v.link }}">FLV</a> |
<a href="http://keepvid.com/?url={{ v.link }}">3GP</a> |
@pije76
pije76 / routes.php
Last active August 29, 2015 14:06 — forked from buchin/routes.php
<?php
Route::get('seed', function(){
Artisan::call('db:seed');
});
@pije76
pije76 / filters.php
Last active August 29, 2015 14:06 — forked from buchin/filters.php
App::missing(function($exception)
{
return Redirect::to('/');
});
DELETE * FROM `images` where local_url = '';
@pije76
pije76 / header.php
Last active August 29, 2015 14:06 — forked from buchin/header.php
<?php
if(is_search()){
echo spp(get_search_query(), 'metadesc.html')
}
?>