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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
<?php | |
/** \file jsonError.php | |
* \brief This code defines an error catch function to detect any errors in the JSON formatting. It converts the obscure code to the definition as provided in the JSON documentation. | |
* @see http://php.net/manual/en/function.json-last-error.php | |
* | |
*/ | |
function jsonErrorCatch() { | |
switch (json_last_error()) | |
{ | |
//JSON_ERROR_DEPTH |
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
# Mips program to reverse a string | |
# mips.s | |
.data | |
str: .space 128 # character buffer | |
.text | |
.globl main |
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
for /f "delims=" %%d in ('dir /s /b /ad ^| sort /r') do rd "%%d" |
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
#inspired by http://cube-drone.com/comics/c/version-sacrifice | |
# note: you'll need to pip install pygithub | |
import time | |
import urllib2 | |
import random | |
from github import Github | |
def nvl(var, val): | |
if var is None: | |
return val |
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
import os | |
import copy | |
from PIL import Image | |
from pyPdf import PdfFileWriter, PdfFileReader | |
def append_pdf(input,output): | |
[output.addPage(input.getPage(page_num)) for page_num in range(input.numPages)] | |
output = PdfFileWriter() | |
cwd = os.getcwd() |
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
param ( | |
[Parameter(Mandatory=$true)][string]$Hostname | |
) | |
$failure = "" | |
while (!$failure) { | |
try { | |
$net = [System.Net.Dns]::GetHostAddresses($Hostname) | |
$Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'DarkGreen') | |
} catch [Exception] { | |
$failure = "yes" |
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
import requests, json, time, os | |
ABS_URL = 'http://www.abs.gov.au/api/demography/populationprojection' | |
def getData(): | |
r = requests.get(ABS_URL) | |
return json.loads(r.text) | |
def getPopulation(): | |
text = getData() |
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
import requests | |
import os, sys | |
url = sys.argv[1] | |
dicts_dir = sys.argv[2] | |
result_dir = sys.argv[3] | |
def import_dict(dir, filepath): | |
file = open(os.path.join(dir,filepath), 'r') | |
return [item for item in file] |
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
import socket | |
import subprocess | |
import sys | |
url = str(sys.argv[1]) | |
remoteIp = socket.gethostbyname(url) | |
print "Scanning " + url + " (" + remoteIp + ")" | |
try: | |
for port in range(1,5000): |
OlderNewer