Skip to content

Instantly share code, notes, and snippets.

View ArcticEcho's full-sized avatar
👋
I'll get round to it, eventually.

Sam ArcticEcho

👋
I'll get round to it, eventually.
View GitHub Profile
vector<WavFileRead> VSSEnvironment::GetChannels(string directory)
{
vector<WavFileRead> files;
if (DirectoryTools::FileExists(directory + ChannelsFunctions::GetFriendlyName(FrontLeft) + ".wav"))
{
files.push_back(WavFileRead(directory + ChannelsFunctions::GetFriendlyName(FrontLeft) + ".wav"));
}
if (DirectoryTools::FileExists(directory + ChannelsFunctions::GetFriendlyName(FrontRight) + ".wav"))
<A class=\"signature user-227577\" href=\"/users/227577/sam\">\r\n<DIV style=\"DISPLAY: none\" class=tiny-signature
jQuery17106276336429219909=\"318\">\r\n<DIV class=\"avatar avatar-16\"><IMG title=Sam alt=Sam src=\"http://i.stack.imgur.com/Y22En.png?s=128&amp;g=1&amp;g&amp;s=16\"
width=16 height=16></DIV>\r\n<DIV class=\"username owner\">Sam</DIV></DIV>\r\n<DIV style=\"DISPLAY: block\" class=\"avatar avatar-32 clear-both\"
jQuery17106276336429219909=\"57\"><IMG title=Sam alt=Sam src=\"http://i.stack.imgur.com/Y22En.png?s=128&amp;g=1&amp;g&amp;s=32\" width=32 height=32>\r
\n<DIV></DIV></DIV>\r\n<DIV style=\"DISPLAY: block\" class=\"username owner\" jQuery17106276336429219909=\"56\">Sam</DIV>\r\n<DIV class=flair title=125
public static KeyValuePair<string, string> GetLastChatMessage(string html)
{
var startIndex = html.LastIndexOf("username owner", StringComparison.Ordinal);
startIndex = html.IndexOf(">", startIndex, StringComparison.Ordinal) + 1;
// Get username.
var username = html.Substring(startIndex, (html.IndexOf(">", startIndex + 1, StringComparison.Ordinal) - startIndex) - 5);
// Get message.
"<p>I recently upgraded to Yosemite, but I'm not sure if this is a Yosemite-related bug.</p>\r\n\r\n<p>My application folder (/Applications) does not open in finder (see screenshots)\r\nThe spinner keep spinning in the bottom right corner.\r\nAlso, when I \"Get Info\", it keeps calculating the size and never completes.\r\nAlso, when I drag the Applications folder to the dock, nothing happens.</p>\r\n\r\n<p>However, it works fine in Terminal:</p>\r\n\r\n<pre><code>$ cd /; ls -lh\r\ndrwxrwxr-x+ 129 root admin 4.3K Oct 17 03:14 Applications\r\n</code></pre>\r\n\r\n<p>When I go inside the Applications folder (in terminal), I can list all the files in it.Oddly enough, most of them are greyed out, and it only says \"total 8\" when I have way more than 8 apps.</p>\r\n\r\n<pre><code>$ cd /Applications; ls -lh\r\ntotal 8\r\ndrwxr-xr-x 4 root wheel 136B Apr 23 2013 3Hub.app\r\ndrwxr-xr-x@ 4 myusername staff 136B May 20 13:02 Adium.app\r\ndrwxrwxr-x 5 root admin 170B Feb 7 2013 Adobe\r\ndrwxrwxr-x
private static void TestMethod1()
{
var str = new [] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p' };
// Remove
var t = new char[20];
for (var i = 0; i < 20; i++)
{
public ReportLog()
{
byte[] uncompBytes;
using (var file = File.OpenRead(path))
using (var compStrm = new GZipStream(file, CompressionMode.Decompress))
{
uncompBytes = new byte[file.Length];
var strm = new MemoryStream();
private unsafe static BigInteger Sqrt(BigInteger num, BigInteger n)
{
var squaresUnder100 = new Dictionary<int, int> { { 1, 1 }, { 2, 4 }, { 3, 9 }, { 4, 16 }, { 5, 25 }, { 6, 36 }, { 7, 49 }, { 8, 64 }, { 9, 81 } };
var pairCount = 0;
var pairs = GetSqrtPairs(num, out pairCount);
// Find the largest integer whose square is smaller than or equal to the current pair.
var pairSq = (BigInteger)1;
foreach (var sq in squaresUnder100)
{
if (latestReview != null && latestReview.AuditPassed == false && (DateTime.UtcNow - latestReviewTimestamp).TotalMinutes > 1)
{
// We can be pretty sure they've been temporarily banned.
endSession();
return;
}
if (sessionReviews.Count + TodaysCVReviews.Count >= (reviewsAvailable > 1000 ? 40 : 20))
{
// They've ran out of reviews.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using ChatExchangeDotNet;
namespace Hatman.Commands
{
class CommandName : ICommand
http://stackoverflow.com/q/9845002
http://stackoverflow.com/q/26027582
http://stackoverflow.com/q/23024960
http://stackoverflow.com/q/15223400
http://stackoverflow.com/q/28342612
http://stackoverflow.com/q/28069000
http://stackoverflow.com/q/14109687
http://stackoverflow.com/q/2167481
http://stackoverflow.com/q/34917422
http://stackoverflow.com/q/32219863