Skip to content

Instantly share code, notes, and snippets.

git rebase --exec 'git commit --amend --no-edit -n -S' -i <previous-commit>
make a branch from your branch with unsigned commits (git checkout -b ...)
use git log --show-signature to see which are not signed
use the commit BEFORE the first one you want to fix in the above command (as <previous-commit>)
accept the generated file (don't change it)
save the file
use git log --show-signature to show the commits are now signed
push up
@mattrobertsky
mattrobertsky / gist:ef279f90cd550975c58783c29d10576b
Created June 27, 2019 09:38
how to run mongo in docker container
sudo service mongod stop
docker run -p 27017:27017 --name mongo -d mongo:3.6
mongo
# n.b. you may get a warning that your shell and server versions differ
@mattrobertsky
mattrobertsky / gist:fcecc54fc6ec2652f7ae0342983e4c18
Last active November 25, 2019 15:04
Manual return data munging
Goto https://github.com/hmrc/app-config-production/blob/master/soft-drinks-industry-levy.yaml
Find the commented out (or in history) data-corrector-b64encoded
Paste value into REPL e.g. val bytesEncoded = '....'
val textDecoded = new String(java.util.Base64.getDecoder.decode(bytesEncoded))
too see the entire content do println(textDecoded)
the decoded Json represents a list of returns that haven't been submitted - update the sdil-ref, period and data to match your usecase
re-encode...
val json = "...."
val bytesEncoded = java.util.Base64.getEncoder.encode(json.getBytes())
add back into app-config-production and deploy
@mattrobertsky
mattrobertsky / decrypt-datastream.txt
Created October 22, 2018 10:04
decrypt datastream
dave@dave-XPS-15-9550:~$ sm --stop DATASTREAM
killing service name: DATASTREAM
name: DATASTREAM ppid: 5191 pid: 7483 uptime: 01:20
dave@dave-XPS-15-9550:~$ sm --start DATASTREAM --appendArgs '{"DATASTREAM":["-DeventEncrypter.enabled=false"]}' -fo
Starting 'DATASTREAM' from SNAPSHOT...
[u'./datastream/bin/datastream', u'-Dconfig.resource=application.conf', u'-J-Xmx256m', u'-J-Xms64m', u'-J-XX:MaxPermSize=128m', '-Dhttp.port=8100', '-Dservice.manager.serviceName=DATASTREAM', '-Dservice.manager.runFrom=SNAPSHOT', u'-DeventEncrypter.enabled=false']
'DATASTREAM' version 'None' started with PID = 7859
All services passed healthcheck
dave@dave-XPS-15-9550:~$
def varyReturn(sdilRef: String): Action[JsValue] =
Action.async(parse.json) { implicit request =>
withJsonBody[ReturnVariationData] { data =>
Logger.info("SDIL return variation sent to DMS queue")
val page = views.html.return_variation_pdf(data, sdilRef).toString
// TODO gist this..
import sys.process._
import java.io.PrintWriter
grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'
mkdir -p ~/bin
echo '#!/usr/bin/env bash
{
sleep 1
echo "use sdil-submissions"
echo "db.dropDatabase()"
} | mongo' > ~/bin/clearSdilDb.sh
insert usb
boot machine hitting F12
select boot from usb
if you get not enough space msg boot again with F12 and go down to BIOS
set secure boot enabled to false
set System Configuration -> SATA Operation to AHCI
reboot hitting F12 then boot from USB
Normally now use the build pipeline
DEV DEPLOY
1. Goto https://build.tax.service.gov.uk/
2. Search for your service (top-right)
3. Find and check the automated build (build history, clicky build number, copy version number)(maybe build now)
4. # Goto https://ci-dev.tax.service.gov.uk
5. # Search for create-a-release-slug
6. # Build with parameters using service name and copied version number from 3
7. Goto http://orchestrator.tools.development.tax.service.gov.uk/