Skip to content

Instantly share code, notes, and snippets.

View majindageta's full-sized avatar

davide.ricci majindageta

View GitHub Profile
# DynamoDb Local Serverless
[https://www.npmjs.com/package/serverless-dynamodb-local](url)
`sls dynamodb install && sls dynamodb start --migrate`
# DynamoDB admin console
[https://www.npmjs.com/package/dynamodb-admin](url)
`DYNAMO_ENDPOINT=http://localhost:8000 dynamodb-admin --port 8000`
REBUILD SPOTLIGHT
sudo mdutil -E /
https://blog.supereasyapps.com/how-to-fix-spotlight-search-on-mac-spotlight-search-not-showing-apps/
TextEdit Open default new
defaults write -g NSShowAppCentricOpenPanelInsteadOfUntitledFile -bool false
@majindageta
majindageta / example.dart
Last active November 29, 2022 06:45 — forked from jokecamp/example.dart
Dart HMAC SHA 256 Example code
import 'dart:html';
import 'dart:convert';
import 'package:crypto/crypto.dart';
void main() {
String secret = 'secret';
String message = 'Message';
List<int> secretBytes = utf8.encode(secret);
download https://rtyley.github.io/bfg-repo-cleaner/
clone `git clone --mirror git://example.com/some-repo.git`
if your files to delete are in the last "master" commit, delete the file and push
.
The last master commit is always preserved so you need to make another commit.
then `bfg --delete-files filename.txt my-repo.git`
my-repo.git is the name in your folder
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) {
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
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`
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
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);
@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