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
+ public static Group [] getgrouplist (string username) | |
+ { | |
+ // Syscall to getpwnam to retrieve user uid | |
+ Passwd pw = Syscall.getpwnam (username); | |
+ if (pw == null) | |
+ return new Group [0]; | |
+ // initialising the lngroups by 1 to get the group count | |
+ int ngroups = 1; | |
+ // allocating buffer to store group uid's | |
+ uint [] groups = new uint [ngroups]; |
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
/* | |
## Mono JIT compiler version 2.10.9 (tarball Mon May 7 20:25:51 EDT 2012) | |
DynamicMethod creation: 0.0453009000ms | |
LINQ expressions creation: 0.0971724000ms | |
Delegate creation: 0.0044351000ms | |
DynamicMethod invocation: 0.0000612000ms | |
Expression invocation: 0.0000609000ms | |
MethodInfo invocation: 0.0007135000ms | |
Delegate invocation: 0.0000619000ms |
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
$ adb shell pm list packages Scratch. | cut -c 9- | |
Scratch.AlertDialog | |
Scratch.AndroidSpecificLocale | |
Scratch.Deadlock | |
Scratch.DefaultTemplate | |
Scratch.ExceptionPropogation | |
Scratch.ExpandableListActivity | |
Scratch.FieldSetLrefOverflow | |
Scratch.Hello | |
Scratch.HttpsDownload |
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
int | |
Mono_Posix_Syscall_syslog (int priority, const char* message) | |
{ | |
#ifdef __GCC__ | |
#pragma GCC diagnostic push | |
#pragma GCC diagnostic ignored "-Werror=format-security" | |
#endif | |
syslog (priority, message); |
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
class Memoization<T, TResult> { | |
internal Memoization (Func<T, TResult> f, IDictionary<T, TResult> d) | |
{ | |
Invoke = f; | |
Values = d; | |
} | |
public Func<TResult> Invoke {get; private set;} | |
public IDictionary<T, TResult> Values {get; private set;} |
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: http://pastebin.com/Hg8vkNAu | |
// | |
// Suggested improvement: | |
static readonly Dictionary<Type, Func<byte[], object>> Decoders = new Dictionary<Type, Func<byte[], object>>() { | |
{ typeof (string), x => Encoding.UTF8.GetString(x) }, | |
{ typeof (byte[]), x => x }, | |
}; | |
public void Add<T>(string cmd, MessageReceiver<T> receiver) | |
{ |
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
$ csharp | |
Mono C# Shell, type "help;" for help | |
Enter statements below. | |
csharp> class X { public int Foo {get;set;} } | |
csharp> var x = typeof(X); | |
csharp> x.GetProperty("Foo").GetGetMethod().IsVirtual; | |
false |
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
using System; | |
namespace Total | |
{ | |
class Total | |
{ | |
static void Main() | |
{ | |
int Total = 0; | |
for (int counter = 0; counter < 10; ++counter) { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ArrayOfItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | |
<Item Completed="true"> | |
<DoItem>fds</DoItem> | |
</Item> | |
<Item Completed="false"> | |
<DoItem>Find</DoItem> | |
</Item> | |
</ArrayOfItem> |
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
using System; | |
class Test { | |
public static void Main () | |
{ | |
var v = Environment.OSVersion; | |
Console.WriteLine (" Platform: {0}", v.Platform); | |
Console.WriteLine (" Service Pack: {0}", v.ServicePack); | |
Console.WriteLine (" Version: {0}", v.Version); | |
Console.WriteLine ("Version String: {0}", v.VersionString); |