Skip to content

Instantly share code, notes, and snippets.

View nithinkr1shna's full-sized avatar
🎯
Focusing

Nithin Krishna nithinkr1shna

🎯
Focusing
View GitHub Profile
# To find from where a constant is required
# Ex used ` require sidekiq/testing`
# place this code at top of application.rb or in this specific we can place it at top of test_helper
module Kernel
alias original_require require
def require(path)
puts "Requiring: #{path} (from #{caller(1..1).first})" if path == 'sidekiq/testing'
@nithinkr1shna
nithinkr1shna / how-to-upgrade-heroku-postgresql.md
Created December 20, 2023 18:35 — forked from simonw/how-to-upgrade-heroku-postgresql.md
How to upgrade a Heroku PostgreSQL database to a new plan

How to upgrade a Heroku PostgreSQL database to a new plan

I started a project on a Hobby Dev plan (free, limit 10,000 rows), and then later needed to upgrade it to Hobby Basic ($9/month, limit 10,000,000 rows).

After assigning the new database, I had two databases attached to the application. They looked something like this:

  • HEROKU_POSTGRESQL_OLIVE (postgresql-dimensional-3321) Old, free-tier (Hobby Dev) database
git_current_branch () {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
@nithinkr1shna
nithinkr1shna / sidekiq_cheat_sheet.md
Last active March 12, 2023 08:06 — forked from wakproductions/sidekiq_cheat_sheet.md
Sidekiq Commands Cheat Sheet
@nithinkr1shna
nithinkr1shna / clear-sidekiq-jobs.sh
Created September 20, 2022 08:54 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

void interpreter_loop(int * instructions, int * constants, int length, int fn_status) {
int i, opc;
for (i = 0; i < length; i++){
opc = instructions[i];
switch (opc) {
case LOAD_CONST:
i = push_w(opc, i, instructions, constants, fn_status);
break;
case STORE_NAME:
i = pop_w(opc, i, instructions, constants);
STOP_CODE 0
BINARY_MULTIPLY 20
BINARY_DIVIDE 21
BINARY_MODULO 22
BINARY_SUM 23
BINARY_SUB 24
PRINT_ITEM 71
STORE_NAME 90
LOAD_CONST 100
LOAD_NAME 101
while (!feof(pyc_pointer)) {
fread(buffer, sizeof(char), 1, pyc_pointer);
hex_str_p += sprintf(hex_str_p, "%02X", (unsigned char) buffer[0]); //converting binary to hex
}
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int htod(char *hex){
int len;
len = strlen(hex);
len--;
int decimal = 0, val, i = 0;