Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikita Abdullin 0xABD

View GitHub Profile
@0xABD
0xABD / copyDeps.gradle
Last active May 22, 2019 — forked from n-belokopytov/copyDeps.gradle
Gradle script that generates a task to copy all build variant's dependencies to a certain directory for use with Nexus IQ Server. It copies exploded AARs too, renaming the classes.jar file into "<aar_dependency_name>.jar".
View copyDeps.gradle
apply plugin: 'com.android.application'
android.applicationVariants.all { variant ->
task "copyDependencies${variant.name.capitalize()}"() {
outputs.upToDateWhen { false }
doLast {
println "Executing copyDependencies${variant.name.capitalize()}"
variant.getCompileClasspath().each { fileDependency ->
def sourcePath = fileDependency.absolutePath
def destinationPath = project.projectDir.path + "/build/dependencies/${variant.name}/"
@0xABD
0xABD / bakts.bat
Created Feb 12, 2019
Create a *.bak copy with timestamp
View bakts.bat
@ECHO OFF
for /f %%a in ('time_stamp.exe') do (set ts=%%a)
copy %1 %1.%ts%.bak
View simple-https-server.py
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
View simple-https-server.py
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@0xABD
0xABD / hello_csharp.cmd
Created Aug 2, 2016
Windows batch file containing self-compiling C# code, automatic .NET path detection. Compiles itself to "filename.cmd.exe" with CSC.EXE from .NET installation. If already compiled, launches the *.exe.
View hello_csharp.cmd
/* This section is run in batch file mode
@echo off
REM Based on http://stackoverflow.com/a/13485357
SETLOCAL ENABLEEXTENSIONS
if not exist %0.exe (
for /f "usebackq tokens=1,3 delims= " %%A in (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP" /s /e /f InstallPath 2^>nul ^| findstr InstallPath ^| sort /R`) do (
set FrameworkDir=%%B
goto :found
)
:found
View keepawake.py
import time
import sys
import os
import ctypes
ES_CONTINUOUS = 0x80000000
ES_AWAYMODE_REQUIRED = 0x00000040
ES_SYSTEM_REQUIRED = 0x00000001
ES_DISPLAY_REQUIRED = 0x00000002
@0xABD
0xABD / teets.bat
Created Sep 30, 2015
tee a pipe into a timestamped log
View teets.bat
@ECHO OFF
for /f %%a in ('timestamp.exe') do (set ts=%%a)
tee %* log_%ts%.log
@0xABD
0xABD / hexdump.py
Last active Jan 10, 2017 — forked from 1mm0rt41PC/hexdump.py
hexdump with full support for python2.x and python 3.x
View hexdump.py
def hexdump( src, length=16, sep='.' ):
'''
@brief Return {src} in hex dump.
@param[in] length {Int} Nb Bytes by row.
@param[in] sep {Char} For the text part, {sep} will be used for non ASCII char.
@return {Str} The hexdump
@note Full support for python2 and python3 !
'''
result = [];
@0xABD
0xABD / bakts.bat
Created Sep 7, 2015
backup file "filename.ext" to "filename.ext.YYYYMMDDHHMISS.bak" using timestamp.exe
View bakts.bat
@ECHO OFF
for /f %%a in ('timestamp.exe') do (set ts=%%a)
copy /V "%1" "%1.%ts%.bak"
@0xABD
0xABD / timestamp.c
Created Sep 7, 2015
print local timestamp as YYYYMMDDHHMISS
View timestamp.c
#include <stdio.h>
#include <time.h>
/*
@ECHO OFF
for /f %%a in ('timestamp.exe') do (set ts=%%a)
echo %ts%
*/
int main(int argc, char **argv)