Skip to content

Instantly share code, notes, and snippets.

@ktkaushik
ktkaushik / SomeController.rb
Created April 22, 2012 06:52
Using Prawn in your Rails App to download and attach the pdf in your email
require 'pdf_generator'
class TasksController < ApplicationController
include PdfGenerator
def some_action
pdf_generator( download = true )
end
end
@ktkaushik
ktkaushik / code.hbs
Created September 12, 2022 12:36
Checkly <> Spike.sh Integration code
{
{{! Embeds for the SSL expiry notifications}}
{{#eq ALERT_TYPE "ALERT_SSL" }}
"title": "{{ALERT_TITLE}}",
"ssl_days_remaining": "{{SSL_DAYS_REMAINING}}",
"ssl_domain": "{{SSL_CHECK_DOMAIN}}"
{{else}}
{{! Embeds for the standard failure, recovery and degraded notifications}}
"event": "{{ALERT_TITLE}}",
"type": "{{ALERT_TYPE}}",
@ktkaushik
ktkaushik / err.log
Created May 11, 2022 07:00
sharp install errors
npm ERR! path /home/ubuntu/status-page/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! make: Entering directory '/home/ubuntu/status-page/node_modules/sharp/build'
npm ERR! TOUCH Release/obj.target/libvips-cpp.stamp
npm ERR! CXX(target) Release/obj.target/sharp/src/common.o
npm ERR! sharp.target.mk:137: recipe for target 'Release/obj.target/sharp/src/common.o' failed
npm ERR! make: Leaving directory '/home/ubuntu/status-page/node_modules/sharp/build'
npm ERR! info sharp Using cached /home/ubuntu/.npm/_libvips/libvips-8.8.1-linux-arm64v8.tar.gz
npm ERR! gyp info it worked if it ends with ok
@ktkaushik
ktkaushik / redis.sh
Created June 25, 2015 12:09
LUA Eval script to Delete/Expire multiple keys in Redis
EVAL "for i, name in ipairs(redis.call('KEYS', 'author_*')) do redis.call('expire', name, 0); end" 0
@ktkaushik
ktkaushik / .gitlab-ci.yml
Created February 21, 2020 17:10 — forked from superjose/.gitlab-ci.yml
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
@ktkaushik
ktkaushik / status_header_setter
Created April 17, 2012 11:32
Set HTTP status headers with respond_with( object ) in rails.
1xx Informational
100 Continue :continue
101 Switching Protocols :switching_protocols
102 Processing :processing
2xx Success
200 OK :ok
@ktkaushik
ktkaushik / keybase.md
Last active September 9, 2019 20:28
keybase.io

Keybase proof

I hereby claim:

  • I am ktkaushik on github.
  • I am ktkaushik (https://keybase.io/ktkaushik) on keybase.
  • I have a public key ASA0BToHdQfC376ogv4fH8l4mTBvBG7lblIjG1XVmgHwOAo

To claim this, I am signing this object:

@ktkaushik
ktkaushik / nginx.conf
Created August 12, 2019 11:37 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ktkaushik
ktkaushik / IAMCredentials.json
Created August 4, 2019 15:40 — forked from ServerlessBot/IAMCredentials.json
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
<svg id="Layer_1" style="height: 30px; width: 30px; fill: #fff" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 29 25">
<defs>
<style>.cls-1{filter:url(#filter-2);}.cls-2{fill:none;stroke:#ff0095;}</style>
<filter id="filter-2" x="-50.5" y="-50.5" width="28" height="28" name="filter-2">
<feGaussianBlur result="shadowBlurInner1" stdDeviation="1" in="SourceAlpha"/>
<feOffset result="shadowOffsetInner1" in="shadowBlurInner1"/>
<feComposite result="shadowInnerInner1" operator="arithmetic" k2="-1" k3="1" in="shadowOffsetInner1" in2="SourceAlpha"/>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" in="shadowInnerInner1"/>
</filter>
</defs>