Skip to content

Instantly share code, notes, and snippets.

@smalot
smalot / PdfParser.php
Last active February 13, 2022 09:59
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <sebastien@malot.fr>
* @date : 2013-08-08
*
* References :
@ajdavis
ajdavis / watcher.py
Created January 4, 2017 13:14
Script based on the Python "watchdog" module to run tasks when files change.
#!/usr/bin/env python
import os
import re
import threading
import time
import subprocess
from os.path import splitext, expanduser, normpath
import click
@xflr6
xflr6 / walk_gdrive.py
Last active January 31, 2024 19:11
Recursively traverse the directory tree of a Google Drive folder as variation of os.walk()
"""os.walk() variation with Google Drive API."""
import os
from apiclient.discovery import build # pip install google-api-python-client
FOLDER = 'application/vnd.google-apps.folder'
def get_credentials(scopes, *,
@dideler
dideler / example.md
Last active February 17, 2024 20:24
A python script for extracting email addresses from text files.You can pass it multiple files. It prints the email addresses to stdout, one address per line.For ease of use, remove the .py extension and place it in your $PATH (e.g. /usr/local/bin/) to run it like a built-in command.

The program below can take one or more plain text files as input. It works with python2 and python3.

Let's say we have two files that may contain email addresses:

  1. file_a.txt
foo bar
ok ideler.dennis@gmail.com sup
 hey...user+123@example.com,wyd
hello world!
@kadin2048
kadin2048 / emlToMbox.py
Last active March 19, 2024 03:55
Combine a directory of .eml files into a single Unix "mbox" file.
#!/usr/bin/env python3
""" Converts a directory full of .eml files to a single Unix "mbox" file.
This is similar to http://www.cosmicsoft.net/emlxconvert.html
Accepts as input either an individual .eml file or a directory containing one
or more .eml files.
Usage:
$ ./emlToMbox.py inputdir/ output.mbox
@blinksmith
blinksmith / golang.udl.xml
Last active April 18, 2024 08:53
Notepad++ Syntax Highlight for Go
<NotepadPlus>
<UserLang name="Golang" ext="go" udlVersion="2.1">
<!--
NPP Syntax Highlight for Go
using most used color in NPP for Golang.
Author: blinksmith Version: 0.1.3
Last tested in Notepad++ v7.5.9
Quick start :
Method 1
@dantheman213
dantheman213 / Xbox Controller (GCPad).ini
Last active April 21, 2024 16:03
Dolphin Gamecube/Wii emulator / Xbox One Controller profile
# Dolphin Gamecube/Wii emulator / Xbox One Controller profile
# Gamecube Controller
# Location -> C:\User\<your user>\Documents\Dolphin Emulator\Config\Profiles\GCPad\Xbox Controller (GCPad).ini
[Profile]
Device = XInput/0/Gamepad
Buttons/A = `Button A`
Buttons/B = `Button B`
Buttons/X = `Button X`
Buttons/Y = `Button Y`