Skip to content

Instantly share code, notes, and snippets.

View darraghoriordan's full-sized avatar

Darragh O'Riordan darraghoriordan

View GitHub Profile
@darraghoriordan
darraghoriordan / getLocalScreenImages.ps1
Created July 26, 2017 07:33
How to get your windows lock screen images
$destinationFolder = "$Env:userprofile\desktop\lockscreenimages"
$lockScreenImageStore = "$Env:userprofile\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
$File = Get-ChildItem -Path "$lockScreenImageStore" -Recurse
if (!(Test-Path -path $destinationFolder)) {New-Item "$destinationFolder" -Type Directory}
for($i = 0; $i -lt $File.Count; $i++)
{
Copy-Item -Force $File[$i].FullName ("$destinationFolder\" + $File[$i].BaseName + $i +".jpg")
import java.nio.charset.StandardCharsets;
import java.security.SignatureException;
import java.security.spec.EncodedKeySpec;
import com.eviware.soapui.support.types.StringToStringMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import javax.xml.bind.DatatypeConverter;
import java.sql.Date.*;
batch_size=64
no_of_epochs=1
# do it
vgg = Vgg16()
# Grab a few images at a time for training and validation.
# NB: They must be in subdirectories named based on their category
train_batches = vgg.get_batches(train_path, batch_size=batch_size)
val_batches = vgg.get_batches(valid_path, batch_size=batch_size*2)
vgg.finetune(train_batches)
vgg.model.optimizer.lr = 0.01
{
"root": "build/",
"clean_urls": false,
"routes": {
"/**": "index.html"
}
}
@darraghoriordan
darraghoriordan / machine.js
Last active April 14, 2020 04:56
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
npm install -g create-react-app
create-react-app my-app
cd my-app
git init
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"
git push heroku master
heroku open
@darraghoriordan
darraghoriordan / swaggeruiconfig.cs
Created September 19, 2017 09:17
a config for swagger ui
.EnableSwaggerUi(c=>
{
c.InjectStylesheet(assemblyType, "Api.SwaggerExtensions.swaggeroverrides.css");
c.InjectJavaScript(assemblyType, "Api.SwaggerExtensions.hmac-sha1.js");
c.InjectJavaScript(assemblyType, "Api.SwaggerExtensions.moment.js");
c.InjectJavaScript(assemblyType, "Api.SwaggerExtensions.enc-base64.js");
c.InjectJavaScript(assemblyType, "Api.SwaggerExtensions.sha256.js");
c.InjectJavaScript(assemblyType, "Api.SwaggerExtensions.apihmacheaderauth.js");
function numberToSocial(bigNum, startAt = 10_000) {
return bigNum < startAt ? bigNum : Intl.NumberFormat("en", {
notation: "compact",
style: "decimal",
maximumFractionDigits: 1,
roundingMode: "floor",
unitDisplay: "narrow",
}).format(bigNum)
}
@darraghoriordan
darraghoriordan / swhmac.groovy
Created September 19, 2017 06:56
Adding custom hmac auth to swagger ui
(function () {
$(function () {
/*I add the ui elements I need here. I thought it would be better put them in here at runtime rather than hard code them in the index.html in case the index.html from my version of swashbuckle is made obsolete in a future version of the package. */
var hmacAuthUi =
'
&lt;div class="input"&gt;&lt;label for="input_api_username"&gt;Api Username: &lt;/label&gt;&lt;input placeholder="Api Username" id="input_api_username" name="input_api_username" type="text" size="20"&gt;&lt;/div&gt;
' +
'
&lt;div class="input"&gt;&lt;label for="input_api_hmackey"&gt;Api Key: &lt;/label&gt;&lt;input placeholder="ApiKey" id="input_api_hmackey" name="input_api_hmackey" type="text" size="20"&gt;&lt;/div&gt;