Skip to content

Instantly share code, notes, and snippets.

View sojan-official's full-sized avatar
🧑‍💻

Sojan Jose sojan-official

🧑‍💻
View GitHub Profile
@sony-mathew
sony-mathew / sendEmailsFromSpreadsheet.js
Last active May 21, 2020 17:31
Google app script function to send emails from a spreadsheet.
/*
Structure of the spreadsheet
Email Name Sending Status Email Send Date Source Lead Created Date Current Status
[email protected] Sony Mathew EMAIL_SENT Thu, 21 May 2020 08:20:37 GMT EMAIL_SENT
*/
// All Contants here
var SPREADSHEET_URL = 'https://docs.google.com/spreadsheets/d/some-random-long-id/edit#gid=0';
@adrianhumphrey111
adrianhumphrey111 / app.py
Last active July 12, 2021 07:45
Flask server to serve multiple agents
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import pickle
import uuid
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active October 23, 2024 14:10
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@kfatehi
kfatehi / _list-github-pull-requests.md
Last active August 8, 2024 21:47
list pull requests across entire organization
@cvan
cvan / HOWTO.md
Last active October 27, 2024 09:49
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@till
till / WIP.md
Last active August 22, 2017 19:57
OpsWorks + DigitalOcean = ❤️

Register a droplet in AWS OpsWorks

AWS Requirements

  • create a new IAM user and attach the AWS OpsWorks Register Policy
  • for testing: create a new stack on AWS OpsWorks and fetch its ID
  • customize all variables prefixed with YOUR_ from the cloud-config.yml

DigitalOcean

@jkubacki
jkubacki / gist:e2dd904bd648b0bd4554
Created January 21, 2015 18:47
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@jackrg
jackrg / active_record.rb
Created May 16, 2014 18:14
Add bulk import functionality to Rails Active Record (add this file to config/initializers, call <model>.import!(array-of-record-hashes))
class ActiveRecord::Base
def self.import!(record_list)
raise ArgumentError "record_list not an Array of Hashes" unless record_list.is_a?(Array) && record_list.all? {|rec| rec.is_a? Hash }
return record_list if record_list.empty?
(1..record_list.count).step(1000).each do |start|
key_list, value_list = convert_record_list(record_list[start-1..start+999])
sql = "INSERT INTO #{self.table_name} (#{key_list.join(", ")}) VALUES #{value_list.map {|rec| "(#{rec.join(", ")})" }.join(" ,")}"
self.connection.insert_sql(sql)

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@jparker
jparker / assets.rake
Created March 23, 2012 23:03
Rake task for compiling assets and uploading them to S3
# RAILS_ROOT/lib/tasks/assets.rake
namespace :assets do
desc 'Precompile assets and upload to S3'
task :upload, [:noop] => ['assets:clean', 'assets:precompile'] do |_, args|
args.with_defaults(noop: false)
Fog.credentials_path = "#{Rails.root}/config/fog_credentials.yml"
Dir.chdir("#{Rails.root}/public") do
assets = FileList['assets',"assets/**/*"].inject({}) do |hsh, path|