Skip to content

Instantly share code, notes, and snippets.

View orliesaurus's full-sized avatar
🥇
Golden Wind

orliesaurus

🥇
Golden Wind
View GitHub Profile
@orliesaurus
orliesaurus / thisfile.py
Last active August 29, 2015 13:57
Remove Escape Chars from text file in Python
#Usage: python thisfile.py "path/to/file.txt" > cleanfile.txt
import re
import sys
with open(sys.argv[1]) as fp:
for line in fp:
newline = re.sub(r'\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]', "", line)
print newline
# from http://zzapper.co.uk/vimtips.html
------------------------------------------------------------------------------
" new items marked [N] , corrected items marked [C]
" *best-searching*
/joe/e : cursor set to End of match
3/joe/e+1 : find 3rd joe cursor set to End of match plus 1 [C]
/joe/s-2 : cursor set to Start of match minus 2
/joe/+3 : find joe move cursor 3 lines down
/^joe.*fred.*bill/ : find joe AND fred AND Bill (Joe at start of line)
/^[A-J]/ : search for lines beginning with one or more A-J
#Retrieved from http://cfenollosa.com/misc/tricks.txt
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- NAME: 1 COLUMN -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>*|MC:SUBJECT|*</title>
<style type="text/css">
body,#bodyTable,#bodyCell{
{
"total": [
{
"id": 37,
"date": "January 2015",
"lanyrd": "http://lanyrd.com/2015/lnug-january/",
"speakers": [
{
"name": "Florian Motlik",
"url": "https://twitter.com/flomotlik",
@orliesaurus
orliesaurus / hack.js
Created January 9, 2017 18:55
Chatlio Addon/Hack
/*
=======
Description: Add a dropdown to Chatlio to let our website audience select an option before entering the live-chat context to provide more information to the support agent.
Author: @orliesaurus
Credits: Thanks to John @ Chatlio for his help figuring it out!
=======
*/
// First we wait for the event to be emitted by the chatlio widget when it is fully rendered on the page
document.addEventListener('chatlio.ready', function (e) {
@orliesaurus
orliesaurus / .js
Created August 16, 2017 17:42
Google Index - Results Bookmarklet Prefixer
javascript:(function(){ var style = document.createElement('style'), styleContent = document.createTextNode('.g { counter-increment: gindex !important; } .g:before { content: counter(gindex) !important; }'); style.appendChild(styleContent ); var ghead = document.getElementsByTagName('head'); ghead[0].appendChild(style); })();