Skip to content

Instantly share code, notes, and snippets.

View Bloody-Badboy's full-sized avatar
😪
Wake me up when we can travel again

Arpan Sarkar Bloody-Badboy

😪
Wake me up when we can travel again
View GitHub Profile
@Bloody-Badboy
Bloody-Badboy / hsl2rgb_rgb2hsl.c
Last active July 4, 2018 03:57
Conversion algorithms for converting HSL to RGB and RGB to HSL vice versa in C
#include <stdio.h>
static void hueToRgb(unsigned int *c, float p, float q, float t) {
if (t < 0.0f)
t += 1.0f;
if (t > 1.0f)
t -= 1.0f;
if (t < 0.166666)
*c = (unsigned int) ((q + (p - q) * 6 * t) * 100);
else if (t < 0.5)
@Bloody-Badboy
Bloody-Badboy / 2d_array_malloc_realloc.c
Last active June 27, 2022 09:44
Simple 2d array dynamic memory allocation and reallocation
#include<stdio.h>
#include<stdlib.h>
int main() {
int row = 5;
int col = 5;
int **arr2d, y, x;
@Bloody-Badboy
Bloody-Badboy / ContentTypes.php
Last active January 30, 2018 15:22
A PHP Class to get content type from file extension
<?php
/**
* Copyright (C) 2015 BloodyBadboyCreation, Inc. (Arpan Bloody Badboy)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@Bloody-Badboy
Bloody-Badboy / BytesSearchUtils.java
Created January 30, 2018 15:32
A utility class to search for certain byte pattern in any file or in bytes array
/*
* Copyright (C) 2015 BloodyBadboyCreation, Inc. (Arpan Bloody Badboy)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Bloody-Badboy
Bloody-Badboy / function_pointer.c
Created March 10, 2018 15:13
C Function Pointer Example
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct _user_ User;
struct _user_ {
char *first_name;
char *last_name;
char *email;
@Bloody-Badboy
Bloody-Badboy / DoubleCheckedSingletonTemplate.java
Last active December 8, 2022 07:05
A Better Singleton template for Intellij IDEA/ Android Studio. To add go to Settings > Editor > File and Code Templates > Hit Create Template and add this one
#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
#end
#parse("File Header.java")
#if (${VISIBILITY} == "PUBLIC")public #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "")implements ${INTERFACES} #end {
private static volatile ${NAME} sInstance = null;
private ${NAME}() {
if (sInstance != null) {
@Bloody-Badboy
Bloody-Badboy / Animators.kt
Created June 27, 2018 09:28 — forked from chrisbanes/Animators.kt
Material Image Loading treatment for Android
/*
* Copyright 2018 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Bloody-Badboy
Bloody-Badboy / dictionary.txt
Created August 7, 2018 04:27
java keywords dictionary for proguard
syNCHRoNizeD
SynChronIzeD
InsTANceOF
synCHrOnIzeD
PRotEctEd
synchrONIzeD
insTanCEoF
sYNcHrOnizeD
IMpLEmENTS
SYnChROnIZeD
# Enable Gradle Daemon
org.gradle.daemon=true
# Enable Configure on demand
org.gradle.configureondemand=true
# Enable parallel builds
org.gradle.parallel=true
# Enable Build Cache
@Bloody-Badboy
Bloody-Badboy / ShowbizView.kt
Created December 14, 2018 17:02 — forked from nickbutcher/ShowbizView.kt
A prototype of an animation I helped out on, see: https://twitter.com/crafty/status/1073612862139064332
/*
* Copyright 2018 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY