This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# A simple script to suck up HTML, convert any images to inline Base64 | |
# encoded format and write out the converted file. | |
# | |
# Usage: python standalone_html.py <input_file.html> <output_file.html> | |
# | |
# TODO: Consider MHTML format: https://en.wikipedia.org/wiki/MHTML | |
import os | |
from bs4 import BeautifulSoup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# MariaDB/MySQL Replication Configuration Script for Ubuntu/Debian | |
# [email protected] 2013-12/2014-09 | |
set -o errexit -o nounset -o pipefail | |
## References | |
# Percona repositories: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
# create system users to be run docker apps | |
# put this file in your /sbin dir and chmod +x it | |
# this script: | |
# - create users without pass | |
# - and them to the docker group |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Source | |
# https://www.raspberrypi.org/forums/viewtopic.php?t=192291 | |
# https://raspberrypi.stackexchange.com/questions/66169/auto-mount-usb-stick-on-plug-in-without-uuid | |
set -e | |
if [[ $EUID -ne 0 ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# https://news.ycombinator.com/item?id=19078825 | |
import traceback | |
import pdb | |
import sys | |
def main(): | |
# some WIP code that maybe raises an exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function debounce(func: (args: IArguments) => any, wait: number, immediate: boolean) { | |
let timeout: number | undefined; | |
return function executedFunction(this: any) { | |
const context: any = this; | |
const args = arguments; | |
const later = () => { | |
timeout = undefined; | |
if (!immediate) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Simple WhatsApp Web Spam Bot Originally written by Pablode. Modified by Gal Bracha. | |
Use with love <3. Do not act reckless. | |
==================================================================================== | |
DISCLAIMER: I do not take any responsibility for any damage caused with this script. | |
WhatsApp might be able identify script users if this becomes a problem. Do only use | |
this if you are aware of the consquences. | |
==================================================================================== | |
Usage: Copy all of this script (Ctrl+A, Ctrl+C). Add a new Bookmark. In the URL section, | |
write "javascript:" and paste (Ctrl+V) this script. Visit WhatsApp Web, select your |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove linha com codigo malicioso de arquivos php hackeados (sed para linux) | |
find . -name "*.php" -exec sed -i '1s/^<?php if(!isset(\$GLOBALS\["\\x61\\156\\x75\\156\\x61.*-1; ?>//' {} \; | |
# Remove linha com codigo malicioso de arquivos php hackeados (sed para mac) | |
find . -name "*.php" -exec sed -i '1s/^<\?php if(!isset(\$GLOBALS\["\\\x61\\\156\\\x75\\\156\\\x61.*-1; \?>//' {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicLookupMixin(object): | |
''' | |
A mixin to add support to related attributes like | |
'book_author' in django ModelAdmin list_display field | |
creating callables on the fly | |
''' | |
def __getattr__(self, attr): | |
if ('__' in attr | |
and not attr.startswith('_') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf8 | |
import re | |
from functools import reduce | |
def merge_dicts(*dicts): | |
# http://stackoverflow.com/questions/7204805/dictionaries-of-dictionaries-merge | |
if not reduce(lambda x, y: isinstance(y, dict) and x, dicts, True): | |
raise TypeError("Object in *dicts not of type dict") |
NewerOlder