Skip to content

Instantly share code, notes, and snippets.

View nitinstp23's full-sized avatar
:octocat:

Nitin Misra nitinstp23

:octocat:
View GitHub Profile
require 'socket'
require 'base64'
Refresh = 1 # seconds to refresh image on server
screen_capture_command = 'screencapture -C -x tmp.png'
image = ''
latest = Time.now
server = TCPServer.new 3000
loop do

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@nitinstp23
nitinstp23 / truncate_rails_tables.rb
Created July 22, 2020 18:30 — forked from romanlehnert/truncate_rails_tables.rb
Truncate all tables in rails
ActiveRecord::Base.establish_connection
ActiveRecord::Base.connection.tables.each do |table|
next if table == 'schema_migrations'
case ActiveRecord::Base.connection.adapter_name.downcase.to_sym
when :mysql2 || :postgresql
ActiveRecord::Base.connection.execute("TRUNCATE #{table}")
when :sqlite
ActiveRecord::Base.connection.execute("DELETE FROM #{table}")
end