Skip to content

Instantly share code, notes, and snippets.

View idlecool's full-sized avatar

Shiv Deepak idlecool

  • Aeroh, Inc.
  • Mountain View, CA
View GitHub Profile

ruby-sam-app

This is a sample template for ruby-sam-app - Below is a brief explanation of what we have generated for you:

.
├── README.md                   <-- This instructions file
├── event.json                  <-- API Gateway Proxy Integration event payload
├── hello_world                 <-- Source code for a lambda function
│   ├── app.rb                  <-- Lambda function code
brew uninstall imagemagick
brew install imagemagick@6
PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.10-43/lib/pkgconfig gem install rmagick -v '2.16.0'
https://space-admin.okta.com/static/agents/ProvisioningAgent/OktaProvisioningAgent-01.02.03.x86_64.exe
@idlecool
idlecool / wikipedia.to.hdfs.sh
Created March 2, 2018 07:26
Copy wikipedia dataset to HDFS
# install p7zip from here - https://gist.github.com/marcesher/7168642#gistcomment-2249579 (careful about the typo)
# extract the dataset on HDFS
7z x -so enwiki-20080103-pages-meta-history.xml.7z | hadoop fs -put - /user/hadoop/enwiki-20080103-pages-meta-history.xml
bundle exec rake db:drop RAILS_ENV=test
bundle exec rake db:create RAILS_ENV=test
bundle exec rake db:schema:load RAILS_ENV=test
@idlecool
idlecool / user.rb
Last active September 14, 2016 06:03
class User
# class method
# User::find
# some people use User.find, I am not one of those
def self.find id
# ...
end
# instance method
# User#where
@idlecool
idlecool / 0_reuse_code.js
Created April 22, 2016 23:51
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@idlecool
idlecool / craigslist.sh
Created January 16, 2016 04:07
cron job to alert when a car is posted on craigslist
#!/bin/bash
countfile="/root/old.count.txt"
touch $countfile
old_count=$(cat $countfile)
new_count=$(curl -s https://sfbay.craigslist.org/search/cto\?search_distance_type\=mi\&min_price\=2000\&max_price\=8000\&auto_make_model\=honda\&max_auto_miles\=100000\&auto_title_status\=1\&query\=%22mountain+view%22+%7C+%22palo+alto%22+%7C+%22sunnyvale%22+%7C+%22menlo+park%22+%7C+%22redwood+city%22+%7C+%22santa+clara%22 | grep paginator| tail -n 1 | ruby -e 'puts /totalcount">([0-9]*)/.match($stdin.read())[1]')
if [ $old_count -ne $new_count ]; then
curl -X POST https://maker.ifttt.com/trigger/cars/with/key/XXXXXXXXXXXXXXXX
echo $new_count > $countfile
#!/usr/bin/env ruby
require 'socket'
require 'redis'
require 'aws-sdk'
ip_address = Socket.ip_address_list.select do |ip|
ip.ipv4_private?
end.first.ip_address

Keybase proof

I hereby claim:

  • I am idlecool on github.
  • I am idlecool (https://keybase.io/idlecool) on keybase.
  • I have a public key whose fingerprint is 1F3B AE01 4644 3AFC 6EC5 B266 C3A4 5A9F E27B 4162

To claim this, I am signing this object: