Skip to content

Instantly share code, notes, and snippets.

View dufferzafar's full-sized avatar
🏠
Working from home

Shadab Zafar dufferzafar

🏠
Working from home
View GitHub Profile
@dufferzafar
dufferzafar / wordFreq.c
Created August 22, 2013 16:07
Frequency analysis of words in a string. C Lab Ques.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main(void)
{
char line[250], words[25][10];
int i=0,j=0,k=0, cntr[25];
int tWords = 0;
@dufferzafar
dufferzafar / Random-Timestamps.py
Created September 10, 2013 03:10
Generate random-increasing timestamps
import time
import math
import random
for x in range(1, 10):
print(math.floor(time.time() + x))
@dufferzafar
dufferzafar / Dllcall-Wallpaper.ahk
Created September 10, 2013 14:24
Set Windows Wallpaper
;The Wallpaper should be BMP
FinalPaper := "Wallpaper.BMP"
DllCall( "SystemParametersInfo", UInt, 0x14, UInt, 0, Str, FinalPaper, UInt, 1 )
@dufferzafar
dufferzafar / Disable-Close-Button.ahk
Created September 10, 2013 14:25
Disable Windows Close Button
DisableCloseButton(hWnd="")
{
If hWnd=
hWnd:=WinExist("A")
hSysMenu:=DllCall("GetSystemMenu","Int",hWnd,"Int",FALSE)
nCnt:=DllCall("GetMenuItemCount","Int",hSysMenu)
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-1,"Uint","0x400")
DllCall("RemoveMenu","Int",hSysMenu,"UInt",nCnt-2,"Uint","0x400")
DllCall("DrawMenuBar","Int",hWnd)
Return ""
@dufferzafar
dufferzafar / GDI-Image-Conversion.ahk
Last active December 22, 2015 17:59
GDI+ Image Conversion
pToken := Gdip_Startup()
; ConvertImage("TuneUp.png", A_Desktop "\Hell.bmp" )
Gdip_Shutdown(pToken)
ConvertImage(InFile, OutFile)
{
pBitmap := Gdip_CreateBitmapFromFile(InFile)
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
@dufferzafar
dufferzafar / Detect-USB.ahk
Last active December 22, 2015 17:59
Detect USB
#Persistent
OnMessage(0x219, "Change")
Change()
{
msgbox, USB Connected
}
@dufferzafar
dufferzafar / Hijack-Windows-Close-Button.ahk
Created September 10, 2013 14:31
Hijack Windows Close Button
Gui, Show, w400 h300, Demo Window
OnMessage(0x112, "WM_SYSCOMMAND")
Return
WM_SYSCOMMAND(wParam)
{
if (A_Gui = 1 && wParam = 0xF060) ; SC_CLOSE
{
MsgBox Nope. ; Optional ;)
return 0
@dufferzafar
dufferzafar / Is-Connected-To-The-Internet.ahk
Created September 10, 2013 14:33
Is Connected To The Internet
If ConnectedToInternet()
Msgbox, 64, WinInet.dll, ONLINE!
else
Msgbox, 48, WinInet.dll, OFFLINE!
Return
ConnectedToInternet(flag=0x40)
@dufferzafar
dufferzafar / Directory Listing.py
Created September 10, 2013 14:48
List Files In Current Directory
import os
# Traverse the current working directory
for file in os.listdir(os.getcwd()):
print(os.path.splitext(file)[0])
@dufferzafar
dufferzafar / Sublime Associations.reg
Created September 10, 2013 17:27
Associate Windows Sublime Text
Windows Registry Editor Version 5.00
; Add to context menu of every file
[HKEY_CLASSES_ROOT\*\shell\Sublime]
@="Open with S&ublime Text"
"Icon"="\"F:\\[Softwares]\\Essentials\\Sublime-Text-3\\sublime_text.exe\",0"
[HKEY_CLASSES_ROOT\*\shell\Sublime\command]
@="\"F:\\[Softwares]\\Essentials\\Sublime-Text-3\\sublime_text.exe\" \"%1\""