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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
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 | |
# inspired in "Monitoring a web page for changes using bash" | |
# http://bhfsteve.blogspot.com.es/2013/03/monitoring-web-page-for-changes-using.html | |
# monitor.sh - Monitors a web page for changes | |
# sends an email notification and a tweet if the file changes | |
# requirements: | |
# - twitter from the command line [https://github.com/sferik/t] | |
# gem install t | |
# - sendemail |
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
# check for an update on a web-page, and email the user | |
import httplib | |
import sys | |
import pickle | |
from datetime import datetime | |
import smtplib | |
from email.mime.text import MIMEText | |
import yaml | |
def email_user(cur_data, email_from, email_to): |
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 | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
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
docker build -t friendlyname . # Create image using this directory's Dockerfile | |
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80 | |
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode | |
docker exec -it [container-id] bash # Enter a running container | |
docker ps # See a list of all running containers | |
docker stop <hash> # Gracefully stop the specified container | |
docker ps -a # See a list of all containers, even the ones not running | |
docker kill <hash> # Force shutdown of the specified container | |
docker rm <hash> # Remove the specified container from this machine | |
docker rm $(docker ps -a -q) # Remove all containers from this machine |
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
# SYNTAX: | |
var pattern = new RegExp(pattern, attributes); # attributes: g (global); i (case-sensitive); m (multiline matches) | |
var pattern = /pattern/attributes; # same as above | |
# BRACKETS: | |
[...]: Any one character between the brackets. | |
[^...]: Any one character not between the brackets. |
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
# === Terminal.app === # | |
# Open new tab in terminal. | |
exec("osascript -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down' > /dev/null 2>&1 ") | |
# Open directory | |
exec("osascript -e 'tell application \"Terminal\" to do script \"cd directory\" in selected tab of the front window' > /dev/null 2>&1 ") | |
# Open directory in new tab (this is better) | |
exec("osascript -e 'tell application \"Terminal\"' -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down' -e 'do script with command \"cd directory && clear\" in selected tab of the front window' -e 'end tell' > /dev/null 2>&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
#opens the files containing the computer network related stuff | |
alias cn='nautilus /media/mohan/Stuffs/Learning/CN && nautilus /media/mohan/Stuffs/Learning/Videos && nautilus /media/mohan/Recent/3rd\ SEM\ RVCE\ Study\ stuff/' | |
#for hibernating | |
alias hib_custom='gksudo pm-hibernate' | |
#set text to clipboard | |
alias setclip="xclip -selection c" | |
#get contents of clipboard |
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
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
using System.Data.OracleClient; |
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
sudo i -t nat -A POSTROUTING -o th -j MASQUERADE | |
S I -t nat -A PREROUTING -i th -j DNAT --to-destination thip | |
OlderNewer