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
function Get-BasicAuthCreds { | |
param([string]$Username,[string]$Password) | |
$AuthString = "{0}:{1}" -f $Username,$Password | |
$AuthBytes = [System.Text.Encoding]::Ascii.GetBytes($AuthString) | |
return [Convert]::ToBase64String($AuthBytes) | |
} | |
function fetch-forks ($orig, $Creds) { | |
#Write-host $orig.forks_url | |
#Write-host $Creds |
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
public static bool SubsetSum(IEnumerable<int> list, int s) | |
{ | |
var arr = list.ToArray(); | |
Array.Sort(arr); | |
var a = arr.Where(i => i < 0).Sum(); | |
var b = arr.Where(i => i > 0).Sum(); | |
if(a > s || b < s) | |
{ | |
return false; | |
} |
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
[quassel] | |
enabled = true | |
port = 4242 | |
filter = quassel | |
logpath = /var/log/quassel/core.log | |
maxretry = 5 |
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 testing; | |
import java.util.List; | |
import com.fasterxml.jackson.core.type.TypeReference; | |
import com.fasterxml.jackson.databind.JavaType; | |
import com.fasterxml.jackson.databind.type.TypeFactory; | |
public class TypeReferenceTest { | |
// used inside ObjectMapper |
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 text; | |
/** Converter that uses bit-shifting to lookup each nibble in a fixed hex | |
* encoding array, yielding higher performance | |
* @author Andrew Brown | |
*/ | |
public class AltConverter implements IntArrToStringConverter { | |
final protected static char[] encoding = "0123456789ABCDEF".toCharArray(); | |
public String convertToString(int[] arr) { | |
char[] encodedChars = new char[arr.length * 4 * 2]; |