background preloader

Python

Facebook Twitter

Python Cheat Sheet by Gameniti - Cheatography.com: Cheat Sheets For Every Occasion. Psutil/INSTALL.rst at master · giampaolo/psutil. Python: Run a process and kill it if it doesn't end within one hour. Append one file to another - Software Development. Is there a way I can fix the way ji get neighbors of a 2d coordinate?

append one file to another - Software Development

I use a webservice to pull some data from it everyday & update it on my MySQL database. I'll make around 600 calls to this service. The webservice response is very slow (takes around 30 minutes to complete 600 transactions) & during this time, the MySQL is also giving slow ... Hello , I have this code: #include <iostream>#include <cstdio>#include <cstdlib>using namespace std; void message(int numbers) { cout << "Entry to function #" << numbers << endl; if ( numbers > 0 ) { cout << "This is a recursive function. " << endl; message( numbers-1 ); } cout ... More Recommended Articles. Python: How to use RegEx in an if statement? Python - Cheap way to search a large text file for a string. Python - How to use a variable inside a regular expression? Python - How to make program go back to the top of the code instead of closing.

Python: Passing variables between functions. Coding style - How do you return multiple values in Python? Variables - What's the best way to return multiple values from a function in Python? Variables - What's the best way to return multiple values from a function in Python? Python - Is it pythonic for a function to return multiple values? Python and SQLite: insert into table.

Python - How can I insert data into a MySQL database? Python: A Simple Step-by-Step SQLite Tutorial. SQLite is a self-contained, server-less, config-free transactional SQL database engine.

Python: A Simple Step-by-Step SQLite Tutorial

Python gained the sqlite3 module all the way back in version 2.5 which means that you can create SQLite database with any current Python without downloading any additional dependencies. Mozilla uses SQLite databases for its popular Firefox browser to store bookmarks and other various pieces of information. In this article you will learn the following: How to create a SQLite databaseHow to insert data into a tableHow to edit the dataHow to delete the dataBasic SQL queries This article will be similar in function to the recent SQLAlchemy tutorial that appeared on this site earlier this month.

How to Create a Database and INSERT Some Data Creating a database in SQLite is really easy, but the process requires that you know a little SQL to do it. First we have to import the sqlite3 library and create a connection to the database. Here we use the INSERT INTO SQL command to insert a record into our database. Append one file to another - Software Development. Twisted. Twisted is an event-driven networking engine written in Python and licensed under the open source ​MIT license. Twisted runs on Python 2 and an ever growing subset also works with Python 3. Twisted makes it easy to implement custom network applications.

Reactor pattern - Wikipedia. Structure[edit] Properties[edit] Benefits[edit] The reactor pattern completely separates application specific code from the reactor implementation, which means that application components can be divided into modular, reusable parts.

Reactor pattern - Wikipedia

Also, due to the synchronous calling of request handlers, the reactor pattern allows for simple coarse-grain concurrency while not adding the complexity of multiple threads to the system. Limitations[edit] The reactor pattern can be more difficult to debug[2] than a procedural pattern due to the inverted flow of control. See also[edit] References[edit] External links[edit] 17.6. sched — Event scheduler — Python 3.5.2 documentation. Source code: Lib/sched.py The sched module defines a class which implements a general purpose event scheduler: class sched.scheduler(timefunc=time.monotonic, delayfunc=time.sleep) The scheduler class defines a generic interface to scheduling events.

17.6. sched — Event scheduler — Python 3.5.2 documentation

Timer - Run a task at specific intervals in python. Sleep - How can I make a time delay in Python? Airmon-ng [Aircrack-ng] Description This script can be used to enable monitor mode on wireless interfaces.

airmon-ng [Aircrack-ng]

It may also be used to go back from monitor mode to managed mode. Entering the airmon-ng command without parameters will show the interfaces status. Usage. Python Scripting Tutorial (Shell) Shell Scripting One of the most useful packages for unix shell scripters in python is the subprocess package.

Python Scripting Tutorial (Shell)

The simplest use of this package is to use the call function to call a shell command: #! /usr/bin/env pythonimport subprocess subprocess.call("ls -l", shell=True) This script will call the unix command "ls -l" and print the output to the console. . #! This script will open the process on unix "tail -500 mylogfile.log", read the output of the command and print it to the console. The first thing the script does is create a variable "proc", this is the process object returned by the call to subprocess.Popen. Shell - Calling an external command in Python. Python - Why is %s better than + for concatenation? Python - print() is showing quotation marks in results. Python - print() is showing quotation marks in results. Python Module of the Week - Python Module of the Week.

Python Cheat Sheet by Gameniti - Cheatography.com: Cheat Sheets For Every Occasion. Hacking Secret Ciphers with Python - Chapters. Chapter 1 Read online: Chapter 1 - Making Paper Cryptography Tools PDF of the Caesar Cipher WheelInteractive Virtual Cipher Wheel Chapter 2.

Hacking Secret Ciphers with Python - Chapters

Automate the Boring Stuff with Python. Checking and replying to email is a huge time sink.

Automate the Boring Stuff with Python

Of course, you can’t just write a program to handle all your email for you, since each message requires its own response. But you can still automate plenty of email-related tasks once you know how to write programs that can send and receive email. For example, maybe you have a spreadsheet full of customer records and want to send each customer a different form letter depending on their age and location details. Commercial software might not be able to do this for you; fortunately, you can write your own program to send these emails, saving yourself a lot of time copying and pasting form emails.

You can also write programs to send emails and SMS texts to notify you of things even while you’re away from your computer. Much like HTTP is the protocol used by computers to send web pages across the Internet, Simple Mail Transfer Protocol (SMTP) is the protocol used for sending email. Airodump-ng [Aircrack-ng] Description Airodump-ng is used for packet capturing of raw 802.11 frames and is particularly suitable for collecting WEP IVs (Initialization Vector) for the intent of using them with aircrack-ng.

airodump-ng [Aircrack-ng]

If you have a GPS receiver connected to the computer, airodump-ng is capable of logging the coordinates of the found access points. Additionally, airodump-ng writes out several files containing the details of all access points and clients seen. Usage.