Skip to content

Instantly share code, notes, and snippets.

View SecurityForUs's full-sized avatar

Eric Hansen SecurityForUs

View GitHub Profile
try:
import json
except ImportError:
import simplejson # Python 2.6 support
data = {'some' : 'data', 'goes' : 'here'}
# To dump data as JSON (might have to append ,"w" to the filename)
with open("/home/bob/.prog_settings") as fp:
fp.write(json.dumps(data))
#!/bin/sh
# Code is swipped from http://legroom.net/2010/05/02/port-testing-and-scanning-bash
#
# Usage: ./portscan.sh <ip>
#
# Change range in {...} block as you please.
function port() {
(echo > /dev/tcp/$1/$2) &> /dev/null
#!/bin/bash
# This script is modified from the one found here: https://wiki.archlinux.org/index.php/IPv6_-_Tunnel_Broker_Setup
# Noticably this script now runs like this:
# $0 <start|stop> <device name>
#
# So if you want IPv6 traffic to be routed through wlan0, you would do:
# $0 start wlan0
if [ "$EUID" -ne 0 ]; then
public Account GetAccountByUri(string account_uri)
{
Require.Argument("account_uri", account_uri);
var request = new RestRequest(Method.GET) { Resource = account_uri };
request.AddParameter("accounts", account_uri, ParameterType.UrlSegment);
return Execute<Account>(request);
}
<?php
// $mp is the reference to your marketplace
$bank = $mp->banks->query()->filter(Balanced\Merchant::$f->uri->eq($merchant_uri))->one();
?>
<?php
// $mp is the reference to your marketplace
$debit = $mp->debits->query()->filter(Balanced\Debit::$f->uri->eq($debit_uri))->one();
// Full refund
$debit->refund();
// Partial refund ($5.00)
$debit->refund(500);
-- in my HTML stuff:
function callback(resp){
var msg = "";
var status = "";
switch(resp.status){
case 201:
$.ajax({
type: 'POST',
async: false,
# Bytes -> $
>>> (23592348 / 21474836.0) * 100
109.86043385849374
# $ -> bytes
>>> (109 / 100.0) * 21474836
23407571.240000002
>>> (109.86043385849374 / 100.0) * 21474836
23592348.0
>>>
<?php
/*** website stuff ***/
$error = array('id' => 1, 'text' => "let's pretend this array is an error that we want to disaply with <b roken HTML");
file_put_contents("/tmp/site.error", json_enode($error));
?>
<?php
/*** cli/console stuff ***/
$data = json_decode(file_get_contents("/tmp/site.error"));
error--------------------------------------
[friendly_html] => <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="https://www.balancedpayments.com/marketplaces
[01:23:00] Nitish Kumar: Balanced\Exceptions\HTTPError Object
(
[response] => Httpful\Response Object