Skip to content

Instantly share code, notes, and snippets.

View anderssonjohan's full-sized avatar
👨‍🚒

Johan Andersson anderssonjohan

👨‍🚒
View GitHub Profile
# Add this line to your profile.ps1
. $PSScriptRoot\vsvars.ps1

Keybase proof

I hereby claim:

  • I am anderssonjohan on github.
  • I am anderssonjohan (https://keybase.io/anderssonjohan) on keybase.
  • I have a public key whose fingerprint is F668 8115 9A5A 8E65 A325 88CB 4530 2BE0 9334 A9FE

To claim this, I am signing this object:

@anderssonjohan
anderssonjohan / Info.plist
Created March 1, 2016 21:21
OSX SmartCardServices driver config with the ACS122U product ID (0x2200) disabled (/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/Info.plist)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>libccid.dylib</string>
<key>CFBundleIdentifier</key>
<string>org.debian.alioth.pcsclite.smartcardccid</string>
@anderssonjohan
anderssonjohan / report-xunit-to-karma-osx.sh
Last active February 2, 2016 13:35
Hack to send xUnit test result to the OSX notification center when having a running karma-osx-reporter
#!/usr/bin/env bash
# Use this to hijack the karma-osx-reporter web service listening to localhost:1337 to send
# xUnit result to the OSX notification center.
# See https://github.com/petrbela/karma-osx-reporter for output.
#
# Usage: ./report-osx-notifier.sh <path to xunit report.xml>
#
message=`grep "assembly" $1 | sed -e 's/[=\"]/ /g' | tr -s ' ' | grep -o "total[^>]*"`
method="pass"
if [ -z "$(echo $message | grep 'failed 0')" ]; then

Usage

  1. Put server.coffee and fake-api.coffee next to config.coffee
  2. Register server.coffee in config.coffee server: path: 'server.coffee'
  3. Add required modules to package.json npm install --save express http-proxy

Notes

@anderssonjohan
anderssonjohan / test-parsedate.ps1
Created April 8, 2015 18:53
Test cases for parsing UTC dates to a datetime that can be used to compare datetime values in an sql database where all datetime columns are in UTC but without timezone specifier
param( [switch] $passOnly )
function TypeConvert-DateTime {
param( $dtString )
[ScriptBlock]::Create(@"
[System.ComponentModel.TypeDescriptor]::GetConverter( [datetime] ).ConvertFrom( "$dtString" )
"@ )
}
function ParseAdjustUtc-DateTime {
param( $dtString )
@anderssonjohan
anderssonjohan / profile.ps1
Created March 31, 2015 16:27
Profile.ps1 that fixes the problem with missing PSDrives when running Powershell with elevated privileges
# Reconnect PSDrives for network connections when running with elevated privileges
# Fixes http://stackoverflow.com/questions/4742992/cannot-access-network-drive-in-powershell-running-as-administrator
$elevated = (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
if( $elevated ) {
net use | ?{ $_ -match ":\s+\\\\" -and !$_.StartsWith("Unavailable") } | %{
$tokens = $_.split(":")
$psdrivename = $tokens[0][$tokens[0].length-1]
$path = $tokens[1].trim().split(" ")[0].trim()
if( !(get-psdrive | ?{ $_.Name -eq $psdrivename } )) {
@anderssonjohan
anderssonjohan / generate-createscript.ps1
Created September 29, 2014 08:16
Sample script we use at RemoteX to generate a SQL file with the database schema. We call this script each time we make a change script (migration), which will be used when setting up new DB instances rather than executing all the change scripts.
param(
[parameter(mandatory=$false)]
$sqlInstance = "(local)",
[parameter(mandatory=$false)]
$database,
[switch] $silent
)
$csFilePath = join-path -resolve $PSScriptRoot "Services/RESTService/Service/connectionstrings.config"
$CreateTablesSql = join-path -resolve $PSScriptRoot "Setup/SetupSkeleton/DB/Schema/CreateScripts/CreateTables.sql"

Integratör sökes till RemoteX!

Vår duktiga, men inhyrda konsult/integratör, har lämnat oss pga flytt och nu jagar vi en ny person som tycker det är kul att koda kod, integrera system och inte är rädd för att möta likasinnade ute hos våra kunder och partners. Som anställd hos oss har man fördelar av den lilla organisationen i kombination med spännande kunder. Hos oss är det "högt i tak" och den person som vi anställer kommer att rapportera direkt till vår team lead för kundprojekt.

I kod används främst c# men vi har även med ruby, python, node.js, powershell där det lämpat sig bättre. Vi använder både PC och mac och vanligaste verktygen på utvecklingssidan är Visual Studio, Sublime och Webstorm.

Hos oss är den viktigaste egenskapen att leverera med enkelhet och effektivitet. Vi sätter ett högt värde på vår organisation och därmed vår förmåga att sprida kunskap inom den.

@anderssonjohan
anderssonjohan / StartsWithSubstringOrIndexOfTest.cs
Last active December 18, 2015 21:48
Which method is the fastest one of string StartsWith, Substring and IndexOf? (Spoiler: Substring)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace startswithorsubstring