Skip to content

Instantly share code, notes, and snippets.

View black-dragon74's full-sized avatar
💭

Niraj Yadav black-dragon74

💭
View GitHub Profile
@black-dragon74
black-dragon74 / JSONLoader.swift
Created September 22, 2019 09:56
A helper class to decode JSON data from a JSON file in the bundle or from a `Data` object instance. The class exposes two static functions that user can call without initializing the class.
//
// JSONLoader.swift
// Load JSON from file and data objects effortlessly
//
// Created by Nick on 9/22/19.
// Copyright © 2019 Nick. All rights reserved.
//
import Foundation
@black-dragon74
black-dragon74 / PageViewIndicator.dart
Created April 19, 2020 13:43
A companion widget to PageView in Flutter that provides iOS style page indicators and also provide scroll on tap.
//
// Code is poetry
//
// Created by Nick aka black-dragon74
//
import 'dart:math';
import 'package:flutter/material.dart';
class PageViewIndicator extends AnimatedWidget {
@black-dragon74
black-dragon74 / FixLoveGreenPencilsMalware.sh
Created December 2, 2020 21:04
Fixes love green pencils wordpress malware
#!/bin/bash
# Regex to fix DB is: "s/<script[\s\S]*?>[\s\S]*?<\/script>//g"
totalInfections=0
filesProcessed=0
echo "Welcome to lovegreenpencils malware fixer by black-dragon74"
echo "This fix is divided into 3 phases."
echo "Phase 1 fixes the \`beckup\` files."
@black-dragon74
black-dragon74 / DifferenceArrays.java
Created December 2, 2020 21:16
Difference Arrays
package com.blackdragon74;
import java.util.Scanner;
class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int M = scan.nextInt();
@black-dragon74
black-dragon74 / SudokuSolver.py
Created December 2, 2020 21:19
Solve sudoku fast AF
def find_next_empty(puzzle):
for r in range(9):
for c in range(9):
if puzzle[r][c] == 0:
return r, c
return None, None
def is_valid(guess, puzzle, row, col):
# First check the rows
@black-dragon74
black-dragon74 / compute_sha256.c
Created January 12, 2022 17:50
New way to Calculate SHA256Sum from OpenSSL v3
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h>
#include <openssl/evp.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define EVP_MD_CTX_new EVP_MD_CTX_create
#define EVP_MD_CTX_free EVP_MD_CTX_destroy
#endif