Skip to content

Instantly share code, notes, and snippets.

Nikita Abdullin 0xABD

  • Planet Earth
Block or report user

Report or block 0xABD

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@0xABD
0xABD / ifndef.py
Created Jan 10, 2012
c c++ include header #ifndef guard
View ifndef.py
import string, sys, os
tt = string.maketrans(string.punctuation,'_'*len(string.punctuation))
for fname in sys.argv[1:]:
hname = os.path.split(fname)[-1].upper().translate(tt)
head_str = '#ifndef ' + hname + '\n#define ' + hname+'\n'
tail_str = '\n#endif //' + hname + '\n'
dt = file(fname).read()
@0xABD
0xABD / wol.py
Created Jan 10, 2012
Wake-On-LAN python script for known hosts
View wol.py
#!/usr/bin/env python
#
# Wake-On-LAN python script for known hosts
#
# Copyright (C) 2002 by Micro Systems Marc Balmer
# Written by Marc Balmer, marc@msys.ch, http://www.msys.ch/
# This code is free software under the GPL
#
# Modified for mac-ip-hostname list 2011 by AMMOnium at mail dot ru
#
@0xABD
0xABD / pycrebat.py
Last active Aug 2, 2016
windows: call python script from a newly created bat file
View pycrebat.py
import sys
fname = sys.argv[-1]
fnamef = '.'.join(fname.split('.')[:-1])
file(fnamef+'.bat','wt').write('@python %~dp0'+fname+' %*')
@0xABD
0xABD / fetch_symbols.bat
Created Jan 10, 2012
windows: download debug symbols for all system dll's from c:\windows\system32\
View fetch_symbols.bat
symchk /r c:\windows\system32 /s symsrv*symsrv.dll*c:\symbols*http://msdl.microsoft.com/download/symbols
@0xABD
0xABD / yesno.bat
Created Jan 10, 2012
windows: bat file with python yes/no one-liner
View yesno.bat
@python -u -c "import random,sys;sys.stdout.write(random.choice(['Yes','No']))"
@0xABD
0xABD / battlife.vbs
Created Jan 10, 2012
windows: this vbscript returns the remaining battery percentage
View battlife.vbs
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery",,48)
For Each objItem in colItems
Wscript.Echo objItem.EstimatedChargeRemaining&"%"
Next
@0xABD
0xABD / file_change_notify_to_ftp.ps1
Created Jan 28, 2012
windows: PowerShell: watch for file changes and upload them to FTP
View file_change_notify_to_ftp.ps1
#
# Watch for files in $watchDir that a match a filer $watchFilter
# and upload them to FTP $ftpUrl when they are changed (modified)
#
$ftpUrl = "ftp://username:password@example.com/pub/incoming/"
$watchDir = "C:\temp"
$watchFilter = "*.txt"
function uploadFile($fullFileName)
@0xABD
0xABD / randfile.py
Last active Dec 14, 2015
print a random filename inside the current directory
View randfile.py
#!/usr/bin/env python
import os
import random
dirList = os.listdir('.')
print random.choice(dirList)
@0xABD
0xABD / android-fix-dcim-timestamp.sh
Created Nov 24, 2013
android: fix photo and video timestamps from their filenames
View android-fix-dcim-timestamp.sh
#!/bin/sh
#
# android - fix photo and video timestamps from their filenames
#
# IMG_YYYYMMDD_HHMMSS.jpg
# PANO_YYYYMMDD_HHMMSS.jpg
# VID_YYYYMMDD_HHMMSS.mp4
#
cd /sdcard/DCIM/Camera/
for i in IMG*.jpg; do touch -t ${i:4:8}.${i:13:6} $i; done;
@0xABD
0xABD / paul.py
Created Jun 12, 2014
A tribute to Paul the octopus 2014
View paul.py
#!/usr/bin/env python
import random
class paul:
scores2010 = [
(170, '1:0'),
(110, '2:1'),
(70, '1:1'),
(70, '0:0'),
(60, '2:0'),
You can’t perform that action at this time.