Skip to content

Instantly share code, notes, and snippets.

View piotros's full-sized avatar
💻

Piotr Baran piotros

💻
View GitHub Profile
@piotros
piotros / goldbach.js
Created March 22, 2024 13:44 — forked from ihercowitz/golsbach.js
Goldbach's conjecture
/* Goldbach's conjecture in JavaScript
*
* author: Igor Hercowitz
*/
function isPrime(n) {
if (n % 2 === 0) return false;
var sqrtn = Math.sqrt(n)+1;
@piotros
piotros / sls-aws-sso.md
Created February 16, 2024 09:22 — forked from albankora/sls-aws-sso.md
Serverless Framework with AWS SSO

Edit config file

vim ~/.aws/config

The config file structure example

[profile dev]
sso_session = dev
sso_account_id = XXXXXXXXXXXX
@piotros
piotros / README.md
Created September 15, 2023 08:04 — forked from atenni/README.md
How to permalink to a gist's raw file

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@piotros
piotros / index.js
Last active September 25, 2019 11:06
Rename files tool
#!/usr/bin/env node
const FileHound = require('filehound');
const fs = require('fs');
const files = FileHound.create()
.paths('./application')
.ext('ftlh')
.find();
@piotros
piotros / README.md
Last active September 25, 2019 10:37 — forked from emilio-martinez/README.md

Basic npx script template.

key.replace(new RegExp('^.+\.', ''), '.') // e.g. "ab.qwerty" => ".qwerty"
@piotros
piotros / live-templates.md
Last active September 7, 2016 14:33
WebStorm Live Templates
Abbreviation Description Template text
cl Insert console.log console.log($PARAM$)$END$
clc Insert console.log with colors console.log('%cLOG: $NAME$', 'background: #222; color: $COLOR$', $NAME$)$END$
cls Insert console.log with colors and selected text added as parameter console.log('%cLOG: $SELECTION$', 'background: #222; color: $COLOR$', $SELECTION$)$END$
fun Inserts function expression function($PARAM$) { $END$ }
@piotros
piotros / .gitconfig
Last active February 17, 2024 14:36
Some useful git aliases and settings that I use
[user]
useConfigOnly = true
# [includeIf "gitdir:~/Projects/company1/"]
# path = ~/Projects/company1/.gitconfig
[alias]
# add all
aa = add .