View themeContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {themeContext} from "./main"; | |
import darkStyle from "./themes/dark"; | |
import lightStyle from "./themes/light"; | |
import defaultStyle from "./themes/default"; | |
import * as defaultColors from "./themes/default/app.m.css"; | |
import * as darkColors from "./themes/dark/app.m.css"; | |
import * as lightColors from "./themes/light/app.m.css"; |
View uuidv4.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function uuidv4(): string { | |
return (`${1e7}-${1e3}-${4e3}-${8e3}-${1e11}`).replace(/[018]/g, (c: any) => | |
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) | |
) | |
} |
View update-ssh-sg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from urllib2 import urlopen | |
sg_id = "sg-xxxxxxxx" | |
sg_desc = "user-name" | |
old_ip = "127.0.0.1" | |
current_ip = urlopen("http://ip.42.pl/raw").read() |
View Cache Config Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.magic.config; | |
import org.magic.config.annotation.Aws; | |
import org.magic.config.annotation.LocalDev; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.cache.CacheManager; | |
import org.springframework.cache.annotation.EnableCaching; | |
import org.springframework.cache.concurrent.ConcurrentMapCache; |
View Single item from stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.function.Function; | |
import java.util.stream.Collector; | |
import java.util.stream.Collectors; | |
public class StreamUtils { | |
public static <T> Collector<T, ?, T> singletonCollector() { |
View gist:fb9521be908297d852d5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.then(function (element) { | |
console.info("=> found somethining.."); | |
element.click(); // this wrong since we are not returning and the chain goes goes on | |
}).end() | |
// better? | |
.click().then(function(){console.info("=> found somethining..")}) |
View gist:5c2b858f9a28343a5424
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.findByCssSelector('div.recommendationSection.section') | |
.then(function(section){ | |
section.getAttribute('id') | |
.then(function(id){ | |
console.info("=> found section ID : " + id); | |
section.findById(id+'_secOptMenu_label') | |
.then(function(menu){ | |
console.info("=> Found option menu "); | |
menu.click(); | |
}) |