Skip to content

Instantly share code, notes, and snippets.

View tbhaxor's full-sized avatar
👨‍🚀
Exploring nature beyond Kármán line

Gurkirat Singh tbhaxor

👨‍🚀
Exploring nature beyond Kármán line
View GitHub Profile
@tbhaxor
tbhaxor / nltk-download.py
Last active August 4, 2019 13:43
Downloading all the nltk data
import nltk
nltk.downlod("all")
@tbhaxor
tbhaxor / rot13.py
Created July 20, 2019 16:52
Simple ROT13 Encoder
#!/usr/bin/python3
import codecs
string = input("Enter String for ROT13: ")
print("ROT13:", codecs.encode(string, "rot13"))
@tbhaxor
tbhaxor / hello_world.c
Created July 19, 2019 07:04
A simple hello world in C
#include <stdio.h>
int main()
{
printf("Hello World!!");
return 0;
}
@tbhaxor
tbhaxor / no_redirect_fix.php
Created June 28, 2019 08:41
no redirect bug fix
<?php
session_start();
if (!$_SESSION['email']) {
$_SESSION["sigin_error"] = "Please Signin";
header("Location: index.php");
exit;
}
<?php
if (!$_SESSION['email']) {
$_SESSION["sigin_error"] = "Please Signin";
header("Location: index.php");
}
?>
@tbhaxor
tbhaxor / bug.php
Created June 28, 2019 08:39
No redirect bug
<?php
session_start();
if (!$_SESSION['email']) {
$_SESSION["sigin_error"] = "Please Signin";
header("Location: index.php");
}
include 'dbconnection.php';
@tbhaxor
tbhaxor / unsafe_validation.c
Created June 23, 2019 23:45
demonstrating input validation with unsafe code
/*
* Program to accept all alphanumeric string
*/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
// function to check only human readable data
int valid(const char input[])
@tbhaxor
tbhaxor / safe_unsafe.c
Created June 23, 2019 23:30
The difference between safe and unsafe c functions
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
// checking for any cli argument
if (argc == 1)
{
// sending the
fprintf(stderr, "usage: %s <name>", argv[0]);
@tbhaxor
tbhaxor / division.cpp
Created June 9, 2019 13:29
Example demonstrating try catch in c++
#include <iostream>
using namespace std;
int main()
{
int x, y;
try
{
@tbhaxor
tbhaxor / func_pointer.c
Last active June 9, 2019 10:36
Function pointer explained
int main()
{
/*
* Declaration of function pointer
* @name callback
* @params int
* @returns int
*/
int (*callback)(int);
/*