Skip to content

Instantly share code, notes, and snippets.

View darraghoriordan's full-sized avatar

Darragh O'Riordan darraghoriordan

View GitHub Profile
@darraghoriordan
darraghoriordan / unfollow.js
Last active December 1, 2023 17:52 — forked from JamieMason/unfollow.js.md
Unfollow everyone on twitter.com who doesn't follow you
View unfollow.js
// Unfollow everyone on twitter who doesn't follow you.
// based on:
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
// 1. Go to https://twitter.com/YOUR_USER_NAME/following
// 2. Open the Developer Console. (COMMAND+ALT+I on Mac)
// 3. Paste this into the Developer Console and run it
//
View gist:db9b34a0a94126adc9edabfc2dd37df9
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)
}
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
@darraghoriordan
darraghoriordan / machine.js
Last active April 14, 2020 04:56
Generated by XState Viz: https://xstate.js.org/viz
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
View heroku_config.js
{
"root": "build/",
"clean_urls": false,
"routes": {
"/**": "index.html"
}
}
View heroku.sh
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
View vgg.py
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
View header.groovy
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.*;
@darraghoriordan
darraghoriordan / swaggeruiconfig.cs
Created September 19, 2017 09:17
a config for swagger ui
View swaggeruiconfig.cs
.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");
@darraghoriordan
darraghoriordan / swhmac.groovy
Created September 19, 2017 06:56
Adding custom hmac auth to swagger ui
View swhmac.groovy
(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;