Skip to content

Instantly share code, notes, and snippets.

View anderssonjohan's full-sized avatar
👨‍🚒

Johan Andersson anderssonjohan

👨‍🚒
View GitHub Profile
@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 )

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 / 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
@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>

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:

# Add this line to your profile.ps1
. $PSScriptRoot\vsvars.ps1
@anderssonjohan
anderssonjohan / setup-volume.ps1
Created September 13, 2017 18:13
user data script to initialize, partition and format ebs volume /dev/xvd[drive letter]
function setup-volume {
param(
[parameter(mandatory=$true,helpmessage="drive letter")]
[string] $driveletter,
[parameter(mandatory=$false,helpmessage="file system label")]
[string] $label = ""
)
$driveletter = $driveletter.ToLower()
@anderssonjohan
anderssonjohan / github_projects_condensed.css
Last active October 29, 2020 14:08
GitHub Projects condensed-and-more-like-waffle.io view, used with Stylus and optionally https://github.com/StylishThemes/GitHub-Dark
.project-columns-container {
padding: 0px !important;
}
.project-column {
border-radius: 0px !important;
border-right-width: 0px !important;
margin-right: 0px !important;
min-width: 300px;
}
.card-octicon {
@anderssonjohan
anderssonjohan / upload-and-attach-files.md
Last active October 21, 2019 16:58
Upload and attach file to a case in Lime Field

Step 1 - POST to api/files to create a file object

$ curl -v -u user:pass -H 'Accept: application/json' -H 'Content-Type: application/json' \ 
  -d '{}' https://appname.remotex.net/api/files/
< HTTP/2 201
< content-type: application/json
&lt; content-length: 421
@anderssonjohan
anderssonjohan / default.conf
Created October 30, 2019 08:43
Run oauth2_proxy with nginx auth_request but not if the client already prestented HTTP credentials (basic auth)
server {
listen 80;
server_name localhost;
location /oauth2/ {
proxy_pass http://oauth-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;