Skip to content

Instantly share code, notes, and snippets.

View pol's full-sized avatar

pol llovet pol

View GitHub Profile
@pol
pol / regexCheatsheet.js
Created February 1, 2020 01:59 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@pol
pol / postmortem.md
Created May 21, 2019 13:49 — forked from mlafeldt/postmortem.md
Example Postmortem from SRE book, pp. 487-491

Shakespeare Sonnet++ Postmortem (incident #465)

Date

2015-10-21

Authors

  • jennifer
  • martym
@pol
pol / etc-hosts-on-win.md
Last active July 21, 2018 00:16 — forked from zenorocha/etc-hosts-on-win.md
/etc/hosts on Windows

How to edit your hosts file

notepad

For Windows 10 and 8
  1. Press the Windows key.
  2. Type Notepad in the search field.
  3. In the search results, right-click Notepad and select Run as administrator.
  4. From Notepad, open the following file: c:\Windows\System32\Drivers\etc\hosts
@pol
pol / sc-dl.js
Created March 5, 2012 23:29 — forked from pheuter/sc-dl.js
Bookmarklet that generates download link for a Soundcloud upload
(function(d) {
var dl = d.createElement('a');
dl.innerText = 'Download MP3';
dl.href = "http://media.soundcloud.com/stream/"+d.querySelector('#main-content-inner img[class=waveform]').src.match(/\.com\/(.+)\_/)[1];
dl.download = d.querySelector('em').innerText+".mp3";
d.querySelector('.primary').appendChild(dl);
dl.style.marginLeft = '10px';
dl.style.color = 'red';
dl.style.fontWeight = 700;
})(document);
@pol
pol / agile.sh
Created June 18, 2010 22:41 — forked from sanbornm/agile.py
#!/bin/sh
# Usage: agile.sh "some task name"
APIKEY=your_api_key
curl http://tasks.jaderobbins.com/tasks?user_credentials=$APIKEY --data-urlencode "task[name]=$1"
require 'open-uri'
require 'rubygems'
require 'json'
# Change these settings
hostname = 'home.hostname.com' # the hostname you use to connect to home ip
apikey = 'your-dreamhost-api-key' # a dreamhost api key that has access to all dns functions
# method to generate a unique_id
# TODO: use uuid instead
@pol
pol / gist:170636
Created August 19, 2009 20:22 — forked from tpope/gist:170560
" hashrocket.vim
" vim:set ft=vim et tw=78 sw=2:
if $HASHROCKET_DIR == '' && expand('<sfile>') =~# '/ops/hashrocket\.vim$'
let $HASHROCKET_DIR = expand('<sfile>')[0 : -20]
endif
if $HASHROCKET_DIR == '' && filereadable(expand('~/.bashrc'))
let $HASHROCKET_DIR = expand(matchstr("\n".join(readfile(expand('~/.bashrc')),"\n")."\n",'\n\%(export\)\=\s*HASHROCKET_DIR="\=\zs.\{-\}\ze"\=\n'))
endif
if $HASHROCKET_DIR == ''
@pol
pol / gist:169250
Created August 17, 2009 17:11 — forked from irjudson/gist:163598
# Dev/Apps Capistrano Deployment Script
# Copyright (c) 2009 Montana State University
#
# Version: 0.3
#
# FILE: deploy.mysql.rb
# This deployment file will allow a user to deploy their application
# code to dev.msu.montana.edu
#
# PREREQUISITES
# Azure Hourly Error
from Cron Daemon <root@azure.resortclosings.com>
to root@azure.resortclosings.com
date Tue, Jul 21, 2009 at 4:00 PM
subject Cron <root@azure> /root/scripts/rsnapshot-with-remount hourly
/bin/cp: will not create hard link `/backup/hourly.1/localhost/data/Completed Escrow Documents/10000-19999/10401' to directory `/backup/hourly.1/localhost/data/Completed Escrow Documents/10000-19999/10401'
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot hourly
----------------------------------------------------------------------------