Skip to content

Instantly share code, notes, and snippets.

View kabinpokhrel's full-sized avatar

Kabi Pokhrel kabinpokhrel

  • Pittsburgh
View GitHub Profile
@kabinpokhrel
kabinpokhrel / .htaccess
Created January 25, 2023 15:52
Http To Https Redirect Override File
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@kabinpokhrel
kabinpokhrel / DebugJson.js
Created January 28, 2022 15:28
Simple Json Formatter in ReactJs with Tailwind CSS
/*
* USAGE: <DebugJson data={{"hello": "hello world!"}} />
*/
import React from 'react';
const DebugJson = ({data}) => {
return (
<pre className={"mt-2 p-2 overflow-x-auto whitespace-pre-wrap break-words"}>
@kabinpokhrel
kabinpokhrel / RobinMillerPrimalityTest.java
Last active November 22, 2021 03:49
Robin Miller Primality Test
import java.math.BigInteger;
import java.util.Random;
import java.util.Scanner;
public class RobinMillerPrimalityTest {
private static final BigInteger ONE = new BigInteger("1");
private static final BigInteger TWO = new BigInteger("2");
public static void main(String[] args) {
@kabinpokhrel
kabinpokhrel / PrimeComposite.java
Created October 25, 2021 01:14
Checking if the provided number is prime, composite or 0,1 and -1
import java.util.Scanner;
public class PrimeComposite {
// calculate the remainder of the given number
public static int reminder(int numb, int divisor) {
return Math.floorMod(numb, divisor);
}
public static void main(String[] args) {
System.out.print("Enter a number: ");
@kabinpokhrel
kabinpokhrel / DesCrypto.java
Last active October 2, 2021 19:13
DES Cipher
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
import java.util.Scanner;
public class DesCrypto {
public static void main(String[] args) throws
@kabinpokhrel
kabinpokhrel / useful_links.txt
Created May 23, 2018 10:02
Resources Links
@kabinpokhrel
kabinpokhrel / server.py
Created December 22, 2017 13:35
Simple HTTP Server Implementation in Python 3
import http.server as httpserver
import socketserver
def main(port=None):
if port is None:
port = 8000
handler = httpserver.SimpleHTTPRequestHandler
try:
httpd = socketserver.TCPServer(("", port), handler)
print("serving at port", port)