Skip to content

Instantly share code, notes, and snippets.

View majindageta's full-sized avatar

davide.ricci majindageta

View GitHub Profile
@majindageta
majindageta / vc.m
Created August 1, 2018 12:59
Handle pinch gesture limiting size
- (void)handlePinch:(UIPinchGestureRecognizer *)recognizer {
if (UIGestureRecognizerStateBegan == recognizer.state ||
UIGestureRecognizerStateChanged == recognizer.state) {
// Use the x or y scale, they should be the same for typical zooming (non-skewing)
float currentScale = [[recognizer.view.layer valueForKeyPath:@"transform.scale.x"] floatValue];
// Variables to adjust the max/min values of zoom
float minScale = 0.7;
float maxScale = 2.0;
Verificare accesso al repository npm registry desiderato (esempio: http://npmregistry.ideasolutions.it/)
Da terminale nella cartella del progetto, aggiungere un file .npmrc dove all'interno c'è l'indirizzo del registry:
Esempio: @sgtv:registry=http://npmregistry.ideasolutions.it
Da terminale aggiungere l'account npm adduser --registry {indirizzo}
in fase di registrazione usare la mail senza @ sostituendola con ..
per pubblicare: npm publish {nomeProgetto} --registry {indirizzo}
https://rtyley.github.io/bfg-repo-cleaner/
clone del progetto: `git clone --mirror git://example.com/some-big-repo.git`
dentro questa cartella copiare il file java bfg
da terminale
`java -jar bfg-1.13.0.jar --delete-files sample.ts`
dopo bisogna:
Per effettuare un attacco:
`vegeta attack -duration=5s -rate=10 -targets='input.txt' | tee resultsUser.bin`
o semplicemente:
`vegeta attack -duration=5s -rate=2 -targets='input.txt' | vegeta report` (per visualizzare direttamente il report)
il file input.txt sarà cosi (per efficienza scegliere solo una richiesta)
```
GET https://gxldsc0bij.execute-api.eu-west-1.amazonaws.com/dev/subjects&includeLikingSessions=true
@majindageta
majindageta / file
Last active January 12, 2023 09:48
tar xvzf file.tar.gz
wget https://github.com/tsenart/vegeta/releases/download/cli%2Fv12.2.1/vegeta-12.2.1-linux-amd64.tar.gz
ssh-add -K /Users/username/Downloads/LightsailDefaultPrivateKey-us-east-2.pem
scp /path/to/file username@address:path/to/destination/filename (add all the path, even the file name)
ssh user@url
let string = '';
let counter = 0;
const start = async () => {
await Promise.all(data.Contents.map(async element => {
string += await someAsyncFunc(element);
console.log('Counter: ' + counter);
counter++;
}))
console.log('Finishing');
doSomethingAfterThat(string);
FROM
The base image for building a new image. This command must be on top of the dockerfile.
MAINTAINER
Optional, it contains the name of the maintainer of the image.
RUN
Create a LightSail instance
During creation, remember to change the region
when using a specific region a private key will be created
download the key
you can use the `ssh -i path/to/key user@host`
or you can add the private key (without the .pem extension) inside your .ssh folder, then
edit the config file with the user, url and path to the private key
to copy a file into lightsail, do not log into ssh, but use `scp /path/to/file user@host:./path/where/to/copy`
cd dynamoLocalDirectory
# run the java command
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
#don't close this terminal, open another window
#create the table using a json file
aws dynamodb create-table
--cli-input-json file:///Users/davidericci/Projects/meteosuper-api/localDynamo/create-forecastTable.json
--endpoint-url http://localhost:8000
import readline from 'readline'
import fs from 'fs'
fs.writeFileSync('./output.txt', '', {flag: 'w'})
const readInterface = readline.createInterface(
fs.createReadStream('./folder/list.html'),process.stdout
);
readInterface.on('line', function(line) {