Skip to content

Instantly share code, notes, and snippets.

Kishan B kishaningithub

Block or report user

Report or block kishaningithub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View JSON to Gherkins
var sourceArr = [
{
"article_id": 71942,
"event_code": "A9",
"start_date": "2016-11-25",
"end_date": "2016-12-30",
"quantity_alloted": 120,
"first_delivery_date": "2016-11-25",
"year": 2016,
View Thread max out
1.upto(10_000) do |i|
Thread.new { sleep }
puts i
end
View postgres
#Create user by using following commands
#create user just_cinemas with password 'password123';
#create database just_cinemas;
#GRANT ALL PRIVILEGES ON DATABASE just_cinemas to just_cinemas;
View gist:a5260d05a857ef9c4037
It is not necessary to check all numbers. In fact, the most common algorithm for determining if a number is prime begins at the number 5 (after checking if the number was 2 or 3), and updates by 6 each iteration, and always checks 2 conditions.
So far, it has only been proven that we only need check up the square root of the number we're testing, which is the reason for checking all numbers up to that point. If you're interested, below is a common algorithm for testing for primality.
if(n <= 3)
return n > 1;
else if(n % 2 == 0 || n % 3 == 0)
return false;
View BakFileDestroyer.java
package com.kishan;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Scanner;
public class BakFileDestroyer
{
View gist:0609fe899985be383a48
class ViewController: UIViewController {
var session:AVCaptureSession!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func viewWillAppear(animated: Bool) {
View gitbub-forked-update
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
View gist:6feb328ab9c36d8b0fd4
http://www.fredonia.edu/faculty/math/JonathanCox/math/SumOfSquares/SumOfSquares.html
View Docker Links
@kishaningithub
kishaningithub / Tricks
Last active Aug 29, 2015
Competitive programming maths
View Tricks
Is Fibonacci
- Either 5x^2+4 or 5x^2-4 must be a perfect square
No of perfect squares between a and b
- floor(sqrt(b)) - ceil(sqrt(a)) + 1
GCD (Euclid's algorithm) -
p>0 q>0. If q is 0 p is gcd. If not divide p by q
and take the remainder r. The gcd is the gcd(q,r).
You can’t perform that action at this time.