Skip to content

Instantly share code, notes, and snippets.

@ernestom
ernestom / script-template.sh
Created December 15, 2020 16:08 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
@ernestom
ernestom / delete_documents_from_view_result.rb
Created October 4, 2012 00:55 — forked from KlausTrainer/delete_documents_from_view_result.rb
Delete all documents whose id appears in a given view result.
#!/usr/bin/env ruby
require 'rubygems'
require 'rest_client'
require 'json'
require 'cgi'
def bye
abort("Usage: #{$0} [view_url]\nExample: #{$0} http://admin:[email protected]:5984/db/_design/ddoc/_view/recent-posts")
@ernestom
ernestom / shortags_fixer.php
Created August 21, 2012 18:53 — forked from panquetofobia/shortags_fixer.php
PHP short open tags fixer
<?php
/**
* Short Open Tags fixer.
*
* Usage:
* $ php -d short_open_tag=On -f shortags_fixer.php path/to/file.php
* $ for i in $(find ./ -iname "*.phtml"); do php -d short_open_tag=On -f shortags_fixer.php $i > ~/fixed.txt && cat ~/fixed.txt > $i; done
*/
function fix($file)
# Expand tabs in php files.
$ for i in $(find ./* -iname "*.php"); do awk '{sub("\t"," ",$0); print $0}' $i > ~/e.tmp && cat ~/e.tmp > $i; done
@ernestom
ernestom / hack.sh
Created March 31, 2012 20:46 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#