Skip to content

Instantly share code, notes, and snippets.

View srih4ri's full-sized avatar
🔥
Lighting things on fire, brb

Srihari srih4ri

🔥
Lighting things on fire, brb
View GitHub Profile
@srih4ri
srih4ri / gho.md
Last active January 7, 2026 18:11
Github Open (gho)

gho

Gho is a Fish shell function that quickly opens pages in the current GitHub repository, like pull requests, issues, or specific paths, directly in your browser.

function gho
  open https://(git config --get remote.origin.url|sed -e s/.git//g|sed s,:,/,g)/$argv
end

With gho, you can :

#!/bin/env zsh
myproject=$1
mkdir -p $myproject $myproject/views $myproject/public $myproject/public/javascript $myproject/public/css $myproject/public/images
cd $myproject
touch Gemfile
echo "source 'https://rubygems.org' \n gem 'sinatra' \n gem 'haml' " > Gemfile
bundle
............
Retrieval is half of what Redis does best.
Before you put any data into Redis, you have to figure out how you want to get it back out. How you retrieve data is directly related to which of the five Redis data types you’ll use to store it.
To review, the five Redis data types are: strings, lists, hashes, sets, and sorted sets.
Start by asking yourself what kind of results you want from your data.
What do you need to retrieve?
["http://dev.ehq.local/admin/reports/status?key=reports%3Astore%3Ainformation_report%3A9%3A319%3Alast_30_days%3A2014-02-05+00%3A00%3A00+%2B1100%3A2014-03-07+00%3A00%3A00+%2B1100%3Atrue%3A%7C%7C%7C%7C%7C%3A5"]
____________________________________________________________________________________________________
["set_reports_session_prefixWriting {} to 419413b710fd1ae8e17483c37c835ad2:Admin::ReportsController "]
____________________________________________________________________________________________________
["At 3"]
____________________________________________________________________________________________________
["find_assigned_projectsWriting [\"319\"] to 419413b710fd1ae8e17483c37c835ad2:Admin::ReportsController:assigned_project_ids "]
____________________________________________________________________________________________________
["At 3"]
____________________________________________________________________________________________________
#!/usr/bin/env ruby
file = "/home/srih4ri/code/rm_current_clem/to_delete.txt"
require "dbus"
sesbus = DBus.session_bus
clem_service = sesbus["org.mpris.clementine"]
clem_object = clem_service.object "/Player"
clem_object.introspect
clem_iface = clem_object['org.freedesktop.MediaPlayer']
meta = clem_iface.GetMetadata
file_loc = meta[0]['location'].split('file://').last
desc 'Run Devise tests for all ORMs.'
task :tests do
Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
orm = File.basename(file).split(".").first
system "rake test DEVISE_ORM=#{orm}"
end
end
task :default => :tests
@srih4ri
srih4ri / update_plugin_assets.md
Created November 5, 2012 16:10
Script to copy fedena plugin's assets to public dir on file change ( Using inotify-tools )

Copy the following into a shell script in fedena's root folder, give it executable permissions and run as :

./update_plugin_assets.sh vendor/plugins/my_awesome_plugin
#!/bin/sh
plugin_dir=$1
while inotifywait -r -e modify $plugin_dir ; do
@srih4ri
srih4ri / ruby-tests.rake
Created November 2, 2012 18:52
Ruby-tests for ruby-roxml
task :test do
require 'rake/runtest'
$: << 'lib' << '.'
Rake.run_tests 'test/unit/*_test.rb'
end
namespace :test do
desc "Test ROXML under the Nokogiri parser"
task :nokogiri do
@srih4ri
srih4ri / auth_db.rb
Created September 5, 2011 18:01
A ruby script being called by mod_authnz_external
#!/usr/bin/ruby
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:username => "myuser",
:password => "mypass",
:database => "somedatabase"
@srih4ri
srih4ri / checkip
Created July 17, 2011 15:08
See what the internet calls you. Wrote for giving my IP to friends for slimevolley.
curl -s http://checkip.dyndns.com/|cut -d ":" -f 2|cut -d "<" -f 1
#You might want to alias this thing to something shorter. `checkip` in my case.