Skip to content

Instantly share code, notes, and snippets.

View msvamp's full-sized avatar
😞
That's me

Manas Sambhus msvamp

😞
That's me
  • 01:52 (UTC +05:30)
View GitHub Profile
@msvamp
msvamp / imageResize.php
Created December 25, 2021 08:34
Simple image resizing website in PHP
<?php
header('content-type: text/plain', true);
ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', 'error.log');
$osiz = getimagesize($_FILES['img']["tmp_name"] ?? __FILE__);
if (!$osiz || !ctype_digit(strval($_POST['pix'] ?? "a")) || !in_array($_POST['type'] ?? 0, [1, 2, 3])) {
http_response_code(400);
exit("Unsupported or missing input");
@msvamp
msvamp / restore-notepad-system-fod-capabilities.reg
Created July 15, 2021 17:45
This will allow you to restore the text-editing capabilities of the classic system Notepad, which is available as an optional Feature-on-Demand package in newer versions of Windows 10 and 11. This is typically useful, if you do not want to use the new notepad UWP package, and stick to the old notepad.
Windows Registry Editor Version 5.00
; You must ensure that the "Microsoft-Windows-Notepad-System-FoD-Package"
; optional package is installed and the notepad executable is present at
; its usual location, i.e. at "C:\Windows\System32\notepad.exe"
;
; This will interfere with the text-editing capabilities of the UWP Notepad
; app: https://www.microsoft.com/en-us/p/windows-notepad/9msmlrh6lzf3
; So, it is recommended to remove the UWP app, and have ONLY the optional
; FoD package installed, before you import this file into the registry.
@msvamp
msvamp / noip-ddns-hotplug
Created May 16, 2021 08:30
No-IP DDNS Updater (Hotplug)
#!/bin/sh
[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit
T_DEV='pppoe-wan'
T_LOCK="/tmp/tmp/ddns_$T_DEV.lock"
[ "$DEVICE" != "$T_DEV" -o -e "$T_LOCK" ] && exit
touch "$T_LOCK"
T_USER='username'
@msvamp
msvamp / social-cliques.cpp
Last active December 17, 2020 06:08
Demonstrate social media network using cliques
/* Demonstration of connection suggestions
* in a basic social media network
* using cliques in undirected graph
*/
#include<iostream>
using std::cin;
using std::cout;
#define VMAX 100 // Max no. of vertices to allow