Skip to content

Instantly share code, notes, and snippets.

View sidsbrmnn's full-sized avatar
🎯
Focusing

Siddharth Subramanian sidsbrmnn

🎯
Focusing
View GitHub Profile
@sidsbrmnn
sidsbrmnn / Singleton.cs
Created May 25, 2024 18:32
Generic classes for the use of Singleton in Unity.
using UnityEngine;
public class Singleton<T> : MonoBehaviour
where T : Component
{
public static T Instance { get; private set; }
public virtual void Awake()
{
if (Instance && Instance != this)
@sidsbrmnn
sidsbrmnn / jpgtest.c
Created June 1, 2023 10:53
Test if a given file is JPEG or not in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_BYTES 3
int
main (const int argc, const char *argv[])
{
if (argc != 2) {
@sidsbrmnn
sidsbrmnn / README.md
Created December 10, 2022 14:50
Code Obfuscation in Python

Code Obfuscation in Python

There are a number of code obfuscation tools for Python that you can use to protect your code from being reverse-engineered or accessed by unauthorized users.

One popular code obfuscation tool for Python is PyArmor, which provides a range of features and tools for obfuscating, encrypting, and signing your Python code. PyArmor uses a combination of techniques, such as renaming, string encryption, and bytecode manipulation, to make it difficult for users to understand or modify your code. PyArmor also provides a range of features for managing and controlling access to your obfuscated code, such as licensing, activation, and expiration.

Another code obfuscation tool for Python is Pyminifier, which provides a simple, command-line utility for minifying and obfuscating your Python code. Pyminifier uses a variety of techniques, such as removing comments, whitespace, and docstrings, and renaming variables and functions, to make your code more compact and difficult to read. Pyminifier a

@sidsbrmnn
sidsbrmnn / release.yml
Created October 17, 2022 19:13
GitHub Workflow for Amanda Release
name: publish release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
@sidsbrmnn
sidsbrmnn / main.c
Created August 15, 2021 10:08
C implementation of the Sieve of Eratosthenes to finding all prime numbers up to any given limit.
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int *sieve_of_eratosthenes(const int n) {
int *primes = (int *)malloc(sizeof(int) * (n + 1));
for (int i = 0; i < n + 1; i++) {
primes[i] = 1;
}
@sidsbrmnn
sidsbrmnn / hooks.tsx
Last active September 15, 2022 05:22
React hooks in Typescript
import queryString from 'query-string';
import { useMemo, useState } from 'react';
import { useHistory, useLocation, useParams, useRouteMatch } from 'react-router-dom';
export function useLocalStorage<T>(key: string, initialValue: T) {
const [storedValue, setStoredValue] = useState<T>(() => {
try {
const item = window.localStorage.getItem(key);
return item ? JSON.parse(item) : initialValue;
} catch(error) {
@sidsbrmnn
sidsbrmnn / app.tsx
Last active September 18, 2020 08:32
Protected route using Redux + React Router
import React, { FunctionComponent, useEffect, Suspense } from 'react';
import { useDispatch } from 'react-redux';
import { Switch, Route } from 'react-router-dom';
import { Dashboard, History, Landing } from '../pages';
import { fetchUser } from '../store/auth/thunks';
import ProtectedRoute from './protected-route';
const App: FunctionComponent = () => {
@sidsbrmnn
sidsbrmnn / .babelrc
Last active August 13, 2023 18:11
Production-ready webpack configuration for React applications in Typescript
{
"presets": ["@babel/env", "@babel/react", "@babel/typescript"],
"plugins": [
"@babel/proposal-object-rest-spread",
["@babel/plugin-transform-runtime", { "regenerator": true }]
]
}
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/socket.h>
#include <unistd.h>
#define PORT 80
#define MAXLINE 4096
@sidsbrmnn
sidsbrmnn / LinkedList.java
Last active July 21, 2020 16:21
Linked list operations in Java
public class LinkedList {
private Node head;
public LinkedList() {
}
public LinkedList(Node head) {
this.head = head;
}