Skip to content

Instantly share code, notes, and snippets.

learning every day...

Kjellski kjellski

learning every day...
View GitHub Profile
kjellski / PowerShell
Created Sep 2, 2020 — forked from jchandra74/PowerShell
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization
View PowerShell

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

kjellski / killport
Created Jun 19, 2020
kill a process running on a port
View killport
lsof -n -i4TCP:$1 | awk '{print $2}' | tail -1 | xargs kill
kjellski / Container.js
Last active Apr 27, 2020
Workarround for `pollInterval` with `@apollo/react-hooks/useQuery`
View Container.js
// NOTE: not using poll here because the interval needs to change on every call.
// So we're using multiple hooks to achieve this:
// 1. `useInterval` to keep the recalculation with `setVariablesIntervalCallback` triggering
// 2. `useState` to have a clear state change when we called `setVariablesIntervalCallback`
// 3. `usePrevious` to have data while new data is beeing fetched so the table can stay intact
const Container = ({ children, someValue }) => {
const [variables, setVariables] = useState({
value: calculateValue(),
kjellski / authorize.js
Created May 24, 2018 — forked from kndt84/authorize.js
Sample code: how to refresh session of Cognito User Pools with Node.js and Express
View authorize.js
const AWS = require('aws-sdk');
const CognitoUserPool = require('amazon-cognito-identity-js-node').CognitoUserPool;
const CognitoUserSession = require('amazon-cognito-identity-js-node').CognitoUserSession;
const CognitoUser = require('amazon-cognito-identity-js-node').CognitoUser;
const CognitoIdToken = require('amazon-cognito-identity-js-node').CognitoIdToken;
const CognitoAccessToken = require('amazon-cognito-identity-js-node').CognitoAccessToken;
const CognitoRefreshToken = require('amazon-cognito-identity-js-node').CognitoRefreshToken;
const cfg = require('config').config;

Keybase proof

I hereby claim:

  • I am kjellski on github.
  • I am kjellski ( on keybase.
  • I have a public key ASCJATSC-3yUirUgjDcACMHAhoP_M-djsx60suVhTCKpNQo

To claim this, I am signing this object:

kjellski / akka-config.hocon
Created Jun 10, 2015
Hocon config for logging
View akka-config.hocon
akka {
loglevel = DEBUG
stdout-loglevel = DEBUG
loggers = [ "Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog" ]
actor {
debug {
# enable function of LoggingReceive, which is to log any received message at
# DEBUG level
unhandled = on

Sample service script for debianoids

Look at LSB init scripts for more information.


Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
kjellski / etc_init.d_teamcity
Created Apr 24, 2015
TeamCity Installation
View etc_init.d_teamcity
# /etc/init.d/teamcity - startup script for teamcity
export TEAMCITY_DATA_PATH="/usr/local/.BuildServer"
case $1 in
echo "Starting Team City"
start-stop-daemon --start -c teamcity --exec /usr/local/TeamCity/bin/ start
View at.fsx
//let rec at (pos: int) (l: 'a list) : 'a Option =
// if pos - 1 > l.Length - 1 then
// None
// else if pos = 1 then
// Some(l.Head)
// else
// at (pos - 1) l.Tail
let rec at pos = function
| [] -> None