Skip to content

Instantly share code, notes, and snippets.

View vparihar01's full-sized avatar

Vivek Parihar vparihar01

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sarvagram Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
@vparihar01
vparihar01 / importVideoToAppDir.swift
Created June 26, 2015 14:17
Importing video using the AVAssetExportSession session
Hey Isarathg this is classic use case of IOS devices. Which don't let you access any Photo Album assets directly using path value. To cross check my answer please just check FileExistsAtPath for your file like below -:
println(NSFileManager.defaultManager().fileExistsAtPath( urlvalue.path!))
O/P you will get => False
I also end up with this issue couple of days back After reading the whole IOS documentation. What I have figured it out "We can only access PhotoAlbum Assets if and only if we have PHImageManager session open". To cross check this statement please try below code -:
var currentVideofetch: PHFetchResult!
required init(coder aDecoder: NSCoder) {
@vparihar01
vparihar01 / daily_utility.sh
Last active May 24, 2022 08:16
Useful commands
1. pods spec edit podname |> pods spec edit opencv will open the podspecs.json file which we can edit to our needs. Like changing the download url of PODS.
2. history |> list all the command have been used in command line.
3. netstat -tulpn | grep fms |> list all processes running on the system with their PIDs.
4. To view the current transaction:
SELECT` `* ``FROM` `information_schema.innodb_trx \G
5. To view the currently locked transactions:
SELECT` `* ``FROM` `INFORMATION_SCHEMA.INNODB_LOCKS;
6. To view the transactions currently waiting for a lock:
SELECT` `* ``FROM` `INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
@vparihar01
vparihar01 / confirmation.rb
Created March 20, 2013 14:53
Devise mailer configuration for registration email sending.
#Getting email unscrewed
#First configure Devise email in config/initializers/devise.rb:
config.mailer_sender = "vivek@yopmail.com"
#If you continue to get an error message, did you reboot the server?
#Localhost email testing
#Do this in the shell you’re using to run the Rails server:
#$ export GMAIL_SMTP_USER=username@gmail.com
@vparihar01
vparihar01 / nokogiri_libxml_homebrew_lion_installation.sh
Created June 25, 2013 07:01
How to fix: Nokogiri Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0. dlopen bundle.open. Using homebrew on lion to install nokogiri and lixml
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
ERROR -: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
Start and stop the server on Windows
Start and stop the server on Linux
Start and stop Apache
Start and stop the server on Windows
Start the server from the Start menu
Choose Start > All Programs > Adobe > Flash Media Server 4.5 > Start Adobe Flash Media Server 4.5.
Choose Start > All Programs > Adobe > Flash Media Server 4.5 > Start Flash Media Administration Server 4.5.
Stop the server from the Start menu
@vparihar01
vparihar01 / blockUI
Created March 30, 2012 08:10
Loading Screen for Ajax request using jQuery.blockUI.js
jQuery(function(){
$.ajax({
async:true,
type:'get',
beforeSend:function(request) {
$.blockUI({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
@vparihar01
vparihar01 / user_mailer.rb
Last active June 7, 2019 09:27
Just copy the user_mailers inside your Mailers directory and then inside user_mailers views move welcome_email_to_player.html.haml. Then user UserMailer.welcome_email_to_player.deliver. tada.... Your mail is sent. For out just check this test yomail account => vivek1234@yopmail.com.
class UserMailer < ActionMailer::Base
default :from => "test@test.com"
def welcome_email_to_player
attachments.inline['user_back'] = {
:data => File.read("#{Rails.root.to_s + '/app/assets/images/bg.jpg'}"),
:mime_type => "image/jpg",
:encoding => "base64"
}
mail(:to => "vivek1234@yopmail.com", :subject => "Welcome to here")
end
@vparihar01
vparihar01 / logall.sh
Created January 23, 2019 12:46
tail all logs for forever + apache + nginx
alias logall="forever logs | tail -n 1 | awk '{print $NF}' | sed 's/\x1B\[[0-9;]\+[A-Za-z]//g' | xargs sudo tail -f /var/log/nginx/error.log /var/log/nginx/access.log /var/log/nginx/search.log"
@vparihar01
vparihar01 / migrate-redis.py
Created November 26, 2018 06:12 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.