This file contains hidden or 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
/** | |
* If you search the internet I haven't seen much of a solution for people being able to emulate | |
* the LIKE operator in C# using LINQ with arrays. Most of the solutions run along the lines of working | |
* with the contains() method. | |
* But the LIKE operator is essentially somewhat of a dumbed down version of regex. | |
* In this example I have several class names and I wanted to know which classes match a particular | |
* pattern; the pattern I wanted to match was all classes ending with 'det' | |
* And given below is the working example of this as a console application. | |
**/ | |
using System; |
This file contains hidden or 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
/*Having made a kinect game as promotions for our company, we discovered that there was a problem in taking this game out into | |
public and that was that if anyone stood behind the main player the game would just break in the sense | |
it wouldn't know how to track*/ | |
//the code given by microsoft to activate the kinect tracking is as follows. | |
playerSkeleton = (from s in skeletonData | |
where s.TrackingState == SkeletonTrackingState.Tracked | |
select s).FirstOrDefault(); |
This file contains hidden or 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
<window.resources> | |
<style targettype="{x:Type ContentControl}" x:key="BaseContentControlStyle"> | |
<setter Property="Foreground" Value="#FF204E93" /> | |
<style basedon="{StaticResource BaseContentControlStyle}" targettype="{x:Type Label}"> | |
<setter Property="FontSize" Value="9.2pt" /> | |
<style basedon="{StaticResource BaseContentControlStyle}" targettype="{x:Type Button}"> |
This file contains hidden or 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
<grid textelement.fontfamily="Lucida Grande" x:name="LayoutRoot"> | |
<!-- All other controls in here will automatically inherit Lucida Grande as their font unless specified explicitly not to do so --> | |
</grid> |
This file contains hidden or 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
"""As much as I understood the theorems of the monty hall problem | |
my brain simply refused to take it in and accept, so I wrote a very quick (and dirty) script to just test it out. | |
The script randomly generates two goats (designated as 0) and a car (designated by 1) for three doors (stored in a dictionary. I don't know why I | |
chose that. Anyway. Here's the script... And it works. Funnily enough when writing the program I kept having snippets of thoughts on how staying | |
with your old choice would leave you at 33% anyways since you didn't take advantage of the situation of knowing one door which had a goat behind it | |
That prompted me to write the normal test where based on intuition, you'd stick with the door you picked originally. And yes, everything checks out. | |
Edit: I also thought of the case of what if the game host reveals a door behind which there is a goat BEFORE you make your first pick. | |
Isn't that like the first scenario but the order just reversed? Apparently not. The results move down to 50-50. My mind |
This file contains hidden or 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
"""Quick implementation of the Karatsuba multiplication algorithm while doing | |
the Stanford Algortihms Design and Analysis Part 1 Course""" | |
def karatsuba(x,y): | |
if x < 10 and y < 10: | |
return x*y | |
else: | |
if x > y: | |
divider = pow(10,len(str(x)) / 2) | |
else: | |
divider = pow(10,len(str(y)) / 2) |
This file contains hidden or 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 struct | |
import re | |
#NOTE that the input file given below won't be the same if you sign up for advent of code to try it out yourself. | |
#let me know if it doesn't work for you | |
circuit = {} | |
def parseInstruction(instruction): | |
instructionBreakDown = dict() | |
if re.search(r'AND|OR', instruction): | |
result = re.findall(r'(\w+|\d+) (AND|OR) (\w+) -> (\w+)', instruction)[0] |
This file contains hidden or 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
from collections import defaultdict | |
UNICODE_BLOCKS = { | |
'en': range(0x0000, 0x02AF), | |
'si': range(0x0D80, 0x0DFF), | |
'ta': range(0x0B80, 0x0BFF), | |
'dv': range(0x0780, 0x07BF) | |
} | |
def getlang(text): |
This file contains hidden or 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/perl | |
# ShellBOT | |
# 0ldW0lf - [email protected] | |
# - www.atrix-team.org | |
# Stealth ShellBot Versão 0.2 by Thiago X |
OlderNewer