Skip to content

Instantly share code, notes, and snippets.

Hasan Kara haisi

View GitHub Profile
@haisi
haisi / useful-commands.sh
Last active Nov 27, 2018
useful-commands
View useful-commands.sh
# start a jupyter notebook from any folder
jupyter notebook .
# start a minimal react-app
npm install -g create-react-app
create-react-app react-hello-world
# um alles zusammen zu fassen (module in ein File)
rollup app.js -f esm > file.js
View selenium-tester.js
var webdriver = require('selenium-webdriver');
var keyword = "Magic";
var driver = new webdriver.Builder().
usingServer('http://localhost:4444/wd/hub/').
withCapabilities(webdriver.Capabilities.chrome()).
build();
driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys(keyword);
driver.findElement(webdriver.By.name('btnG')).click();
@haisi
haisi / .gitconfig
Last active Dec 22, 2016
Git Aliases
View .gitconfig
[core]
autocrlf = true
excludesfile = ~/.gitignore
[alias]
unstage = reset -q HEAD --
discard = checkout --
nevermind = !git reset --hard HEAD && git clean -d -f
uncommit = reset --mixed HEAD~
save = commit -m
resave = commit --amend
View Spring-LoggingProvider.java
import org.springframework.beans.factory.InjectionPoint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.DependencyDescriptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.web.context.annotation.SessionScope;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
View downloadAndSaveWebsite.groovy
def content = "https://google.com".toURL().text
writeToFile("C:/tmp", "fhnw-job-ausschreibung", "html", content)
public void writeToFile(String directory, String fileName, String extension, def content) {
new File("$directory/$fileName.$extension").withWriter { out ->
out.println content
}
}
@haisi
haisi / countEachChar.groovy
Created Jun 30, 2016
Groovy-Script to count each character in passed file and prints them in ascending order
View countEachChar.groovy
#! /usr/bin/env
// Example
// groovy countEachChar.groovy MY_TEXTFILE > OUT_PUT_TEXT_FILE
def printErr = System.err.&println
if (args.length == 0) {
printErr "No path is passed as an argument! Exiting!"
return;
@haisi
haisi / EditableTable
Created Nov 7, 2014
Editable JavaFX TableView with textfield, datepicker and dropdown menue
View EditableTable
/*
* I don't care
*/
package editabletableview;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.Date;
You can’t perform that action at this time.