Skip to content

Instantly share code, notes, and snippets.

View ashishwadekar's full-sized avatar

Ashish Wadekar ashishwadekar

  • India
View GitHub Profile
@ashishwadekar
ashishwadekar / gist:4f8d934ee9c2b65b0e7fff49f1c8c014
Created August 17, 2023 15:53 — forked from RiANOl/gist:1077760
AES128 / AES256 CBC with PKCS7Padding in Ruby
require "openssl"
require "digest"
def aes128_cbc_encrypt(key, data, iv)
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize)
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize)
aes = OpenSSL::Cipher.new('AES-128-CBC')
aes.encrypt
aes.key = key
aes.iv = iv
{
"info": {
"_postman_id": "32c262fa-7384-4477-a610-cde252c8829e",
"name": "Tinxy Open APIs",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Device State",
"request": {
@ashishwadekar
ashishwadekar / yubikey-setup.md
Last active May 21, 2020 06:26
Yubikey GPG & SSH Setup on Mac OS

Guide to setting up your existing YubiKey for GPG & SSH authentication on a Mac

1. Download and install GPG Tools Suite

https://gpgtools.org/

2. Launch GPG Keychain application & import your public key & set it's trust level to Ultimate

3. Edit the file ~/.gnupg/gpg-agent.conf & add the following lines to it

enable-ssh-support
@ashishwadekar
ashishwadekar / ffmpeg-wrapper
Created April 26, 2020 19:37 — forked from BenjaminPoncet/ffmpeg-wrapper
Synology VideoStation ffmpeg wrapper with DTS, EAC3 and TrueHD support (Installation instructions in 1st comment)
#!/bin/bash
rev="12"
_log(){
echo "$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - $1" >> /tmp/ffmpeg.log
}
_log_para(){
echo "$1" | fold -w 120 | sed "s/^.*$/$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - = &/" >> /tmp/ffmpeg.log
@ashishwadekar
ashishwadekar / keybase.md
Last active March 26, 2020 10:45
Keybase Proof

Keybase proof

I hereby claim:

  • I am ashishwadekar on github.
  • I am ashishwadekar (https://keybase.io/ashishwadekar) on keybase.
  • I have a public key whose fingerprint is E586 022F D1C8 95B1 D535 18D1 EF44 2D74 95D9 530A

To claim this, I am signing this object:

@ashishwadekar
ashishwadekar / all_email_provider_domains.txt
Created October 8, 2019 17:20 — forked from ammarshah/all_email_provider_domains.txt
A list of all email provider domains (free, paid, blacklist etc). Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0-mail.com
007addict.com
020.co.uk
027168.com
0815.ru
0815.su
0clickemail.com
0sg.net
0wnd.net
0wnd.org
@ashishwadekar
ashishwadekar / rails_helper.rb
Created October 2, 2019 15:53 — forked from Amitesh/rails_helper.rb
Accessing Helper modules in rails
Accessing Helper modules in rails
http://www.funonrails.com/2010/12/accessing-helper-modules-in-rails.html
1. Helper methods all the time for views
class ApplicationController < ActionController::Base
helper :all# include all helpers, all the time for views
end
" Basic Setup
set nocompatible
syntax enable
filetype plugin indent on
set background=dark
set shell=/bin/bash
set linespace=2
set tabstop=2 shiftwidth=2 expandtab
set hlsearch
set number
@ashishwadekar
ashishwadekar / Preferences.sublime-settings
Created March 21, 2019 08:02
Sublime Text Preferences
{
"auto_complete_commit_on_tab": true,
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"draw_white_space": "selection",
"file_patterns":
[
"\\.html\\.erb",
"\\.rb",
"\\.rake",
module JsonSerializer
module_function
#
# Usage:
# JsonSerializer.find_by_id(User, 1, only: [:id, email, :address], except: [:address])
#
def find_by_id(klass, id, options = {})
sql = "SELECT row_to_json(results) FROM (
SELECT #{selected_attributes(klass, options)}