Skip to content

Instantly share code, notes, and snippets.

View clupasq's full-sized avatar

Cristian Lupașcu clupasq

View GitHub Profile
@clupasq
clupasq / wifi_hotspot.bat
Created September 30, 2014 11:53
Win 8 WIFI Hotspot
REM Follow instructions at https://www.youtube.com/watch?v=2pvK-6321ig
REM If it does not work (keeps waiting at obtaining IP address) repeat the first step:
REM - go to "network connections", select the connection you want to share. Go to "properties" and "sharing".
REM - Deselect "Allow other users to connect through this computer's Internet connection". Click "OK".
REM - Go to "properties" and "sharing" again.
REM - select "Allow other users to connect through this computer's Internet connection". Select the network you just created just below that. Click "OK"
REM - Try again to connect. Should work.
netsh wlan set hostednetwork mode=allow ssid=TheW0lf key=<password_here>
netsh wlan start hostednetwork
@clupasq
clupasq / Vs2013DevCmdPrompt.ps1
Created September 16, 2014 15:52
Set Developer Command Prompt (VS 2013) in PowerShell
Function vs2013CommandPromptVariables()
{
pushd 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools'
cmd /c "VsDevCmd.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
@clupasq
clupasq / subByColor.js
Created September 10, 2013 06:52
SumByColor v1.1 - Added methods for Foreground Color - replaced the deprecated getBackgroundColor() with getBackground()
function getBackgroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getBackground();
}
function getForegroundColor(rangeSpecification) {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
return sheet.getRange(rangeSpecification).getFontColor();
}
@clupasq
clupasq / RunnableInDebugOnlyAttribute.cs
Created August 8, 2013 05:45
xUnit.net RunnableInDebugOnlyAttribute
public class RunnableInDebugOnlyAttribute : FactAttribute
{
private string _skip;
public override string Skip
{
get
{
return Debugger.IsAttached
? _skip
@clupasq
clupasq / golfscript.sublime-build
Last active December 19, 2015 21:09
Golfscript Build System for Sublime 3
{
"cmd": ["ruby", "D:\\path\\to\\golfscript.rb", "$file"],
"selector": "source.gs"
}
@clupasq
clupasq / .hgignore
Created June 30, 2013 19:06
basic .hgignore file
# use glob syntax
syntax: glob
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
@clupasq
clupasq / timeout.cs
Created September 4, 2012 12:34
C# Timeout implementation
[Test]
public void ComputeResultWithTimeout()
{
var task = Task.Factory.StartNew(() => ComputeResult("bla"));
//task.Wait(0999);
task.Wait(1000);
if (task.IsCompleted)
Console.WriteLine("OK, got: " + task.Result);
@clupasq
clupasq / gist:2994524
Created June 26, 2012 08:53
Git config
git config --global user.name <user>
git config --global user.email <email>
git config --global help.autocorrect 1
git config --global color.ui auto
git config --global core.autocrlf true
git config --global alias.glog "log --graph --oneline --all --decorate"
git config --global core.editor "C:/Windows/notepad.exe"
@clupasq
clupasq / golfscript_snippets
Last active October 5, 2015 07:58
Golfscript snippets
.,{)\.@%!},,2= # is number prime (expects number on stack and adds 1 or 0 (leaves number on stack))
:§,{)§\%!},,2= # just like above, except this consumes the number from the stack.
..,1>{*}*\%)= # shorter version, using Wilson's theorem (https://en.wikipedia.org/wiki/Wilson%27s_theorem)
# must take a parameter > 1, therwise fails
@clupasq
clupasq / nlog colored console files
Created March 13, 2012 08:52
nlog configuration for colored console + info&error files
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="coloredConsole" xsi:type="ColoredConsole" useDefaultRowHighlightingRules="false"
layout="${longdate}|${pad:padding=5:inner=${level:uppercase=true}}|${message}" >
<highlight-row condition="level == LogLevel.Debug" foregroundColor="DarkGray" />
<highlight-row condition="level == LogLevel.Info" foregroundColor="Gray" />
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />