Skip to content

Instantly share code, notes, and snippets.

@NanoDano
NanoDano / extract_pngs.py
Created July 31, 2016 18:23
Extract PNGs from a file using Python
# extract_pngs.py
# Extract PNGs from a file and put them in a pngs/ directory
import sys
with open(sys.argv[1], "rb") as binary_file:
binary_file.seek(0, 2) # Seek the end
num_bytes = binary_file.tell() # Get the file size
count = 0
for i in range(num_bytes):
binary_file.seek(i)
@NanoDano
NanoDano / analyze_subreddit_titles.py
Last active May 31, 2022 01:02
Word Frequency of a Subreddit's Post Titles
"""
Analyze word frequency in subreddit post titles
Outputs the number of times a word is seen and orders them
by the most used words.
Quick and dirty script that is not optimized
[email protected]
www.devdungeon.com
"""
min_word_length = 5 # Ignore words shorter than this length
@NanoDano
NanoDano / Python Requests Log In
Last active October 1, 2020 01:06
Python Requests Log In to Drupal
import requests
postData = {
'name': 'username',
'pass': 'secret!',
'form_id': 'user_login',
'op': 'Log in'
}
loginUrl = 'http://www.some-drupal-site.com/user'
package main
import (
"net/http"
"fmt"
"flag"
)
func main() {
#!/usr/bin/php
<?php
/**
* filename: ghdb
*
* usage: ghdb [info|list|update]
*
* Crude example of PHP HTML DOM and SQLite combination to archive
* data from a website. Posted as reference.
*