Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Shadab Zafar dufferzafar

🏠
Working from home
View GitHub Profile
@dufferzafar
dufferzafar / wordFreq.c
Created Aug 22, 2013
Frequency analysis of words in a string. C Lab Ques.
View wordFreq.c
#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 Sep 10, 2013
Generate random-increasing timestamps
View Random-Timestamps.py
import time
import math
import random
for x in range(1, 10):
print(math.floor(time.time() + x))
View Dllcall-Wallpaper.ahk
;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 Sep 10, 2013
Disable Windows Close Button
View Disable-Close-Button.ahk
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 ""
View GDI-Image-Conversion.ahk
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)
View Detect-USB.ahk
#Persistent
OnMessage(0x219, "Change")
Change()
{
msgbox, USB Connected
}
View Hijack-Windows-Close-Button.ahk
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
View Is-Connected-To-The-Internet.ahk
If ConnectedToInternet()
Msgbox, 64, WinInet.dll, ONLINE!
else
Msgbox, 48, WinInet.dll, OFFLINE!
Return
ConnectedToInternet(flag=0x40)
@dufferzafar
dufferzafar / Directory Listing.py
Created Sep 10, 2013
List Files In Current Directory
View Directory Listing.py
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 Sep 10, 2013
Associate Windows Sublime Text
View Sublime Associations.reg
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\""