Skip to content

Instantly share code, notes, and snippets.

🙌
Say hi!

Michał Michalczuk michalczukm

Block or report user

Report or block michalczukm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@michalczukm
michalczukm / .gitignore
Created Dec 7, 2018
.NET Core apps minimal .gitignore (including publication settings)
View .gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
@michalczukm
michalczukm / value-types.ts
Last active Aug 9, 2018
Example of using values as types - with type assertion
View value-types.ts
const Foo = {
aFoo: 'SomeAfoo' as 'SomeAfoo',
bFoo: 'SomeBfoo' as 'SomeBfoo',
cFoo: 'SomeCfoo' as 'SomeCfoo',
};
type FooValueTypes = (typeof Foo)[keyof typeof Foo];
function doStuff(value: FooValueTypes) {
}
View how-to-add-image-to-gist.md

How to add an image to a gist

  1. Create or find a gist that you own.
  2. Clone your gist (replace <hash> with your gist's hash):
    # with ssh
    git clone git@gist.github.com:<hash>.git mygist
    
    # with https
    git clone https://gist.github.com/<hash>.git mygist
@michalczukm
michalczukm / extensions.json
Last active Jul 9, 2018
VS Code recommended workspace extensions for any Angular project (and not only :) )
View extensions.json
{
// See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"angular.ng-template",
"mikael.angular-beastcode",
"msjsdiag.debugger-for-chrome",
"ryu1kn.annotator",
@michalczukm
michalczukm / vscode-extensions.sh
Last active Mar 12, 2019
Visual Studio Extensions list and short script to build installable list
View vscode-extensions.sh
##!/bin/bash
# ======= Generate extensions list by:
#code --list-extensions | while read line; do
# echo code --install-extension $line
#done
# ======== My current extensions list
code --install-extension Angular.ng-template
code --install-extension EditorConfig.EditorConfig
code --install-extension PeterJausovec.vscode-docker
@michalczukm
michalczukm / els-reindex.sh
Created Jan 22, 2018
Clone index to another (reindex) in Elastic Search (ELS)
View els-reindex.sh
curl -X POST http://localhost:9200/_reindex?pretty=true -d '{
"source": {
"index": "dev_1"
},
"dest": {
"index": "dev_2"
}
}'
@michalczukm
michalczukm / get-els-data.sh
Created Jan 22, 2018
Get Elastic Search (ELS) data via cURL, to file
View get-els-data.sh
curl -X GET http://localhost:9200/dev-1/categorysearchproductmodel/_search?pretty=true -d '{
"sort" : [
{ "_uid" : {"order" : "asc"}}
],
"query": {
"match_all": {}
}
}' > els-now.json
@michalczukm
michalczukm / mysql-docker.sh
Created Nov 25, 2017 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
View mysql-docker.sh
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@michalczukm
michalczukm / docker-compose.yaml
Created Nov 23, 2017
elasticsearch + kibana docker-compose
View docker-compose.yaml
version: "2.2"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.0.0
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
@michalczukm
michalczukm / azure-function-get-ip.js
Created Nov 13, 2017
Azure function - ask for my current IP
View azure-function-get-ip.js
const https = require('https');
module.exports = function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
https.get('https://ifconfig.co/json', res => {
res.setEncoding('utf8');
let body = '';
res.on('data', data => {
body += data;
You can’t perform that action at this time.