Skip to content

Instantly share code, notes, and snippets.

View przemyslawjanpietrzak's full-sized avatar

Przemyslaw Jan Beigert przemyslawjanpietrzak

View GitHub Profile
# Kill program using one port
sudo fuser -k 8000/tcp
# Rename selected files using a regular expression
rename 's/\.bak$/.txt/' *.bak
# Get full path of file
readlink -f file.txt
# Who is logged in?
# moved to https://github.com/przemyslawjanpietrzak/ubuntu-onStart/blob/master/main.sh
#create s3 bucket
aws s3api create-bucket --bucket <bocket-name> --create-bucket-configuration LocationConstraint=eu-central-1
[
{
"enabled": true,
"updateUrl": "https://userstyles.org/styles/chrome/37035.json?ik-syntax-theme=ik-Twilight&ik-syntax-codemirror=ik-cm-twilight&ik-syntax-jupyter=ik-jp-twilight&ik-bg-choice=ik-yes&ik-bg-options=ik-Tiled&ik-bg-attachment=ik-Scroll&ik-tab-size=ik-0&ik-code-wrap=ik-nowrap&ik-base-color=%234183C4&ik-font-choice=Menlo&ik-bg-url=ik-default",
"md5Url": "https://update.userstyles.org/37035.md5",
"url": "http://userstyles.org/styles/37035",
"originalMd5": "e0b1ec80c4391daac7e3c42041092bf3",
"installDate": 1535963488323,
"sections": [
{
# max warning numbers in eslint
if [ $(npm run lint | grep WARNING | wc -l) -gt 331 ]; then exit 1; fi
@przemyslawjanpietrzak
przemyslawjanpietrzak / no-commented-out-code
Last active September 24, 2018 06:49
no-commented-out-code.ts
// WRONG
// export class ROUTE {
// public static readonly LOGIN = '/login';
// public static readonly RECRUITMENTS = '/recruitments';
// public static readonly RECRUITMENT_EDIT = '/recruitments/:id';
// }
@przemyslawjanpietrzak
przemyslawjanpietrzak / no-inferrable-types.ts
Last active September 24, 2018 14:29
No-inferrable-types
@Output() onChange = new EventEmitter(); // Explicit type parameter needs to be provided to the constructor
@Output() onChange = new EventEmitter<number>(); // OK
@Output() onChange = new EventEmitter<any>(); // also OK
@przemyslawjanpietrzak
przemyslawjanpietrzak / no-string-literal.ts
Last active September 24, 2018 06:49
no-string-literal
// WRONG
obj['key']
// GOOD
obj.key
// WRONG
const fn = (arg) => arg;
// GOOD
const fn1 = (arg: any) => arg;
// GOOD
const fn2 = (arg: number) => arg;
@przemyslawjanpietrzak
przemyslawjanpietrzak / strict-return.ts
Last active September 24, 2018 06:49
strict-return
const fn = () => {
if (true) {
return; // ERROR: Not all code paths return a value.
}
if (false) {
return 42;
}
}