Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof Koziarski kkoziarski

View GitHub Profile
View function-wrappers.ts
const foo1 = (a: string): number =>
{
console.log('foo1', {a});
return a.length;
}
const foo2 = (a: string, b: number): number => {
console.log('foo2', {a, b});
return a.length + b;
}
@kkoziarski
kkoziarski / key-bindings.ahk
Last active May 26, 2021
AutoHotkey (AHK) - open programs
View key-bindings.ahk
SwitchToWindowsTerminal()
{
windowHandleId := WinExist("ahk_exe WindowsTerminal.exe")
windowExistsAlready := windowHandleId > 0
; If the Windows Terminal is already open, determine if we should put it in focus or minimize it.
if (windowExistsAlready = true)
{
activeWindowHandleId := WinExist("A")
windowIsAlreadyActive := activeWindowHandleId == windowHandleId
@kkoziarski
kkoziarski / copy-jwt-token-bookmarklet.js
Created Mar 16, 2020
copy JWT token bookmarklet (jwt-cp)
View copy-jwt-token-bookmarklet.js
javascript: (function() {
var key = window.localStorage.getItem('adal.token.keys').split('|')[0];
var token = window.localStorage.getItem('adal.access.token.key' + key);
if (token) {
/*window.prompt("Copy to clipboard: Ctrl+C, Enter", token);*/
sendToClipbord(token);
}
function sendToClipbord(myString) {
var textarea = document.createElement('textarea');
document.body.appendChild(textarea);
@kkoziarski
kkoziarski / readme.md
Last active Apr 6, 2021
How to run Docker Desktop on Windows 10 Home with WSL2
View readme.md
View VIM-.vimrc
syntax on
" pokazuje menu z lista plikow itp
set wildmenu
"sam zmienia katalogi na te w kotrych edytuje pliki
set autochdir
set autoindent
set history=1000
@kkoziarski
kkoziarski / ..README.md
Last active Feb 27, 2020
WSL setup oh-my-zsh
View ..README.md

setup WSL

wsl --set-default Ubuntu-18.04

Install oh-my-posh

sudo apt-get install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
@kkoziarski
kkoziarski / Startup.cs
Last active Apr 13, 2018
JSNLog sample demo
View Startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace JSNLogCore.Demo
{
public class Startup
{
@kkoziarski
kkoziarski / rx-subscribe-unsubscribe-listeners.ts
Last active Feb 20, 2018
Subscribe with unsubscribe listeners
View rx-subscribe-unsubscribe-listeners.ts
// https://github.com/ng-book/angular2-redux-chat/blob/master/tutorial/06b-rx-store.ts
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subject } from 'rxjs/Subject';
import 'rxjs/add/operator/scan';
interface Action {
type: string;
payload?: any;
}
@kkoziarski
kkoziarski / AudiencesStore.cs
Created Jan 22, 2018
AudiencesStore - create a ClientId(AudienceId) and Base64Secret(AudienceSecret) for JWT tokens
View AudiencesStore.cs
namespace WebApi.Identity.Providers
{
using System;
using System.Collections.Concurrent;
using System.Security.Cryptography;
using Microsoft.IdentityModel.Tokens;
public static class AudiencesStore
{
public static ConcurrentDictionary<string, Audience> AudiencesList = new ConcurrentDictionary<string, Audience>();
@kkoziarski
kkoziarski / jira-copy-description-bookmarklet.js
Last active Oct 2, 2021
Copy JIRA issue number bookmarklet
View jira-copy-description-bookmarklet.js
javascript: (function() {
var id;
var descr;
var a = document.querySelector('#ghx-detail-issue .ghx-group .ghx-key dl.ghx-detail-list dd a');
if (a) {
/*side details*/
id = a.textContent;
descr = document.querySelector('#ghx-detail-issue .ghx-group .ghx-detail-summary dl.ghx-detail-list dd.ghx-detail-description').textContent;
} else if (a = document.getElementById("key-val")) {
/*full page details*/