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
/** | |
* Read a Coinbase transaction export and print out a Cost Basis CSV (useful for tax calculation | |
* of cryptocurrency profits). The output is near the format that TurboTax expects, but not perfect | |
* (likely headers/columns are slightly deformed). This script was written with an export file | |
* which had only a single Coinbase account / wallet, only two currencies, and all transactions were | |
* USD <-> BTC (no conversions/transactions of one crypto for another). | |
* | |
* This script is meant to be run as CLI from Node (probably compatible with 12+ because of use of fs.promises). | |
* Needs an npm repo around this source file, then run `npm install` / `yarn`. | |
* Example commands: |
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
# File for reading a county XML and exporting to OpenElections CSV format | |
# The expected input file was | |
# - downloaded from: https://results.enr.clarityelections.com//CA/Santa_Clara/106043/272625/reports/detailxml.zip | |
# - linked from: https://results.enr.clarityelections.com/CA/Santa_Clara/106043/web.264614/#/summary | |
# Some Python code borrowed from: | |
# - https://www.geeksforgeeks.org/xml-parsing-python/ | |
import csv | |
import json | |
import sys |
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
alert('xss!'); |
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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
*/ | |
'use strict'; | |
var React = require('react-native'); | |
var WebViewBridgeNative = require('react-native-webview-bridge'); | |
var { |
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 strict"; | |
var tests = { | |
"$0.41": 0.41, | |
"$12,345.67": 12345.67, | |
"$1m": 1000000, | |
"$32b": 32000000000, | |
"$0.2t": 200000000000 | |
}; |
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
package main | |
import ( | |
"net/http" | |
"./muxtester" // this is our router library. the "muxtester" dir should be in the same directory as this "main.go" | |
) | |
func main() { | |
http.HandleFunc("/", muxtester.HandleCatchall) | |
http.ListenAndServe("localhost:8080", nil) |
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 | |
/** | |
* Unit Tests for BBCode parser | |
* Uses OWASP cheatsheet to prevent XSS | |
* @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet | |
* | |
* @author CarbonPhyber | |
*/ | |
require dirname(dirname(dirname(__FILE__))) . '/private/common.php'; |
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 | |
/** | |
* \DJW\BBCode | |
* A BBCode translation class | |
* Uses OWASP cheatsheet to prevent XSS | |
* @see https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet | |
* | |
* @author CarbonPhyber | |
*/ | |
namespace DJW; |
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
#!/usr/bin/env php | |
<?php | |
$output = array(); | |
$errorOutput = array(); | |
$return = 0; | |
$pathToErrorFile = 'temp/minify_errors.txt'; | |
file_put_contents($pathToErrorFile, ''); | |
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return); | |
$against = $return == 0 ? 'HEAD' : '4b825dc642cb6eb9a060e54bf8d69288fbee4904'; |
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
# @author David Wortham <djwortham+programming@gmail.com> | |
# @date 2011-04-30 | |
# @license MIT License: http://www.opensource.org/licenses/mit-license.php | |
# isPrime | |
# Function to detect if the input (asserted Fixednum) is a prime number | |
# uses an optional cache (asserted Hash) to speed up subsequent calls | |
def isPrime(number, cache) | |
return false if number < 1 | |
return true if number == 1 |
NewerOlder