Skip to content

Instantly share code, notes, and snippets.

🤓
learning every day...

Kjellski kjellski

🤓
learning every day...
Block or report user

Report or block kjellski

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
@kjellski
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;
const COGNITO_IDENTITY_POOL_ID = cfg.COGNITO_IDENTITY_POOL_ID;
View keybase.md

Keybase proof

I hereby claim:

  • I am kjellski on github.
  • I am kjellski (https://keybase.io/kjellski) on keybase.
  • I have a public key ASCJATSC-3yUirUgjDcACMHAhoP_M-djsx60suVhTCKpNQo

To claim this, I am signing this object:

@kjellski
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
View _service.md

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@kjellski
kjellski / etc_init.d_teamcity
Created Apr 24, 2015
TeamCity Installation
View etc_init.d_teamcity
#!/bin/sh
# /etc/init.d/teamcity - startup script for teamcity
export TEAMCITY_DATA_PATH="/usr/local/.BuildServer"
case $1 in
start)
echo "Starting Team City"
start-stop-daemon --start -c teamcity --exec /usr/local/TeamCity/bin/teamcity-server.sh start
;;
stop)
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
View last_two.fsx
// selfmade :/ not yet...
let rec last_two = function
| [] -> None
| [x] -> None
| x::xs ->
if xs.Length > 1 then
last_two xs
else
Some (x, xs.Head)
View last.fsx
let rec last (l: 'a list) : 'a Option =
match l with
| [] -> None
| [x] -> Some x
| x::xs -> last xs
let list = ["a";"a";"a";"a";"b";"c";"c";"a";"a";"d";"d";"e";"e";"e";"e"]
string list
last list
View compress.fsx
let rec compress = function
| a :: b :: xss ->
if a = b then compress(b::xss) else a:: compress(b::xss)
| smaller -> smaller
let list = ["a";"a";"a";"a";"b";"c";"c";"a";"a";"d";"e";"e";"e";"e"]
string list
compress list
View flatten.fsx
type 'a Node =
| One of 'a
| Many of 'a Node list
let testList = [ One "a" ; Many [ One "b" ; Many [ One "c" ; One "d" ] ; One "e" ] ]
let rec flatten (list: 'a Node list) : 'a list =
let rec flatten_nodes acc (node: 'a Node list) : 'a list =
match node with
You can’t perform that action at this time.