Skip to content

Instantly share code, notes, and snippets.

@costastf
costastf / samsung_remote.py
Last active September 9, 2021 11:19 — forked from danielfaust/samsung_remote.py
Code used to create a class for a samsung remote
import time
import socket
import base64
src = '192.168.1.2' # ip of remote
mac = '00-AB-11-11-11-11' # mac of remote
remote = 'python remote' # remote name
dst = '192.168.1.3' # ip of tv
app = 'python' # iphone..iapp.samsung
tv = 'LE32C650' # iphone.LE32C650.iapp.samsung
@costastf
costastf / gist:ef839efd4f63b93845951da459658b39
Created September 19, 2017 14:08
Basic signal catching with python
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import signal
import logging
__author__ = 'Costas Tyfoxylos <costas.tyf@gmail.com>'
__docformat__ = 'plaintext'
@costastf
costastf / gist:d9f33c098bd90a5942a0f0179df644ef
Created September 20, 2017 14:10
A hack to sync files on inotify events. Quite old proof of concept on inotify events
#!/usr/bin/env python
import os
import pyinotify
import sys
from pyinotify import WatchManager, ThreadedNotifier, ProcessEvent
# from rdiff_backup.Main import Main as backup
from subprocess import Popen
mask = pyinotify.IN_ATTRIB | \
pyinotify.IN_DELETE | \
@costastf
costastf / gist:c9065c86261b67c4ae435f92d47997bc
Created September 20, 2017 14:28
Proof of concept to watch a directory for changes with python on windows XP
import os
import win32file
import win32con
ACTIONS = {
1: "Created",
2: "Deleted",
3: "Updated",
4: "Renamed from something",
5: "Renamed to something"
@costastf
costastf / gist:f943f78f59666698137a741bcf26b36b
Created September 20, 2017 14:33
A simple method to spit an open scanned pdf book to single page output.
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
# Copyright (c) 2010 by None
#
# GNU General Public Licence (GPL)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
@costastf
costastf / gist:968bc0e162f0795889fd78a7d1862d01
Created September 21, 2017 07:23
Legacy script checking switch port status via snmp
from pysnmp.entity.rfc3413.oneliner import cmdgen
#################################################################################################
# Global Settings
deviceIPAddress = "10.12.250.1"
snmpPort = 161
snmp_username = "monitoring"
# Port Status Displayed Information
statusID = {1: "Disabled",
2: "Blocking",
@costastf
costastf / gist:4639375098ef5dd9de59c06dd6c3b74f
Last active September 21, 2017 07:32
Legacy proof of concept code to extract the shell code of a binary
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
# File: shellCodeExtract.py
# Copyright (c) 2011 by Costas Tyfoxylos
#
# GNU General Public Licence (GPL)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
@costastf
costastf / gist:3a63389856c43dcfb22d89164aa7a5de
Created September 21, 2017 07:34
String to reverse double word
#!/usr/bin/env python
#-*- coding: UTF-8 -*-
# File: stringToReverseDoubleWord.py
# Copyright (c) 2011 by Costas Tyfoxylos
#
# GNU General Public Licence (GPL)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
@costastf
costastf / gist:2a45fbdad247ebc6d02034d846e366eb
Created September 21, 2017 07:37
Legacy proof of concept watching a usb device event on windows XP
import win32serviceutil
import win32service
import win32event
import servicemanager
import win32gui
import win32gui_struct
import win32con
import ctypes
import os
@costastf
costastf / gist:2f59954afcf9c35cb3da22b96c9c0a18
Created September 21, 2017 07:41
A hack to sync files on inotify events. Quite old proof of concept on inotify events daemonized
#!/usr/bin/env python
import os, time, pyinotify, sys
from pyinotify import WatchManager, ThreadedNotifier, ProcessEvent
from daemon import Daemon
from rdiff_backup.Main import Main as backup
mask = pyinotify.IN_ATTRIB | pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MODIFY | pyinotify.IN_CLOSE_WRITE
class Watch(ProcessEvent):