Skip to content

Instantly share code, notes, and snippets.

View sXakil's full-sized avatar
:octocat:
Working Remotely

Shakil Ahmmed sXakil

:octocat:
Working Remotely
View GitHub Profile
@sXakil
sXakil / GenPass.java
Created December 2, 2018 16:12
Generate a random alphaneumeric password
package com.ums.pau.resources;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
public class GenPass {
private String str;
private StringBuilder sb;
private List<Integer> l;
public GenPass() {
@sXakil
sXakil / SplashController.java
Last active December 4, 2018 13:10
JavaFX Splash-screen controller
package com.ums.pau.resources;
import com.ums.pau.SceneSwitcher;
import javafx.application.Platform;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
@sXakil
sXakil / LinkedList.java
Last active December 17, 2018 16:40
Implementation of linked list in Java
import java.util.Scanner;
class LinkedList {
static class Node {
String data;
int index;
Node next;
}
private static Node head = null;
public static void main(String[] args) {
int command = 0;
@sXakil
sXakil / avd.desktop
Last active February 23, 2019 04:49
Desktop entry for launching the Android emulator directly
[Desktop Entry]
Version=1.0
Name=AVD
Comment=AVD
Exec=bash -c "cd ~/Android/Sdk/emulator/ && DEVICES=$(./emulator -list-avds) && ./emulator -avd ${DEVICES[0]}"
Icon=/home/$USER/Android/Sdk/platforms/android-28/templates/ic_launcher_xhdpi.png
Terminal=false
Type=Application
Categories=Utility;Application;
@sXakil
sXakil / bd_map.c
Last active December 19, 2022 10:47
A simple program to print the map of Bangladesh based on the ASCII values of a generated string. (Generator script: https://gist.github.com/sXakil/a7377acba95f8ba2b7dddfaf24339c27)
#include <stdio.h>
int main() {
char *str = "ED.GDAD.DLEB.COCC.CV.FS.HQ."
"JN.MP.Go.Cr.Cq.Cp.Fk.Jf.J`.I`.H`ID."
"J^HE.K^FG.N[ABCG.L`CG.MTBT.MUCS.NTD"
"BCBAJ.NUBBHI.OTMI.OROI.OGDCSI.PE[I."
"RC[I.rBDB.rB.sB.tB";
int c, i, j;
for(i = 0, j = 0; str[i] != '\0'; i++, j++) {
c = str[i]-64;
@sXakil
sXakil / ReverseLinkedList.c
Last active April 14, 2019 10:38
Reverse a linked list
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
struct Node *next;
};
typedef struct Node *NodePtr;
import numpy as np
#######---TEST DATA for QUICK CHECKING---#######
# processes = 5
# resources = 3
# allocated = [[0, 1, 0 ],[ 2, 0, 0 ],[3, 0, 2 ],[2, 1, 1] ,[ 0, 0, 2]]
# max_demand = [[7, 5, 3 ],[3, 2, 2 ],[ 9, 0, 2 ],[2, 2, 2],[4, 3, 3]]
# available = [3, 3, 2]
processes = int(input('Number of processes: '))
resources = int(input('Number of resources: '))
# capacity = 3
# pages = [1, 2, 3, 2, 1, 5, 2, 1, 6, 2, 5, 6, 3, 1, 3, 6, 1, 2, 4, 3]
capacity = int(input("Capacity: "))
pages = [int(x) for x in input('Page References (separated by space): ').split(' ')]
current_pages = []
page_indices = []
page_faults = 0
page_hits = 0
for page in pages:
from queue import Queue
# capacity = 3
# pages = [1, 2, 3, 2, 1, 5, 2, 1, 6, 2, 5, 6, 3, 1, 3, 6, 1, 2, 4, 3]
capacity = int(input("Capacity: "))
pages = [int(x) for x in input('Page References (separated by space): ').split(' ')]
current_pages = set()
page_indices = Queue()
page_faults = 0
page_hits = 0
@sXakil
sXakil / bd_map_turtle.py
Last active September 21, 2020 05:45
A python turtle drawing of the map of Bangladesh. Uses the same idea as this- https://gist.github.com/sXakil/d7e88da11830dc1370cb7f89b5ebaae1
import turtle
pen = turtle.Turtle()
pen.ht()
pen.speed(0)
pen.penup()
generator = "ED.GDAD.DLEB.COCC.CV.FS.HQ.JN.MP.Go.Cr.Cq.Cp.Fk.Jf.J`.I`.H`ID.J^HE.K^FG.N[" \
"ABCG.L`CG.MTBT.MUCS.NTDBCBAJ.NUBBHI.OTMI.OROI.OGDCSI.PE[I.RC[I.rBDB.rB.sB.tB "
colors = ["#239B56", "#28B463", "#2ECC71", "#58D68D", "#82E0AA",
"#F1948A", "#EC7063", "#E74C3C", "#CB4335", "#E74C3C", "#EC7063", "#F1948A",
"#82E0AA", "#58D68D", "#2ECC71", "#28B463"]