Skip to content

Instantly share code, notes, and snippets.

View mrWinston's full-sized avatar

Marius Schulz mrWinston

  • Red Hat
  • Rostock, Germany
View GitHub Profile
@mrWinston
mrWinston / wtfplLicenseJavaAndOther
Last active February 2, 2016 11:57
License Java-Like #wtfpl #license #fuck #/* #javalike
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details.
*/
@mrWinston
mrWinston / django_objects_filter_variable.py
Last active February 2, 2016 11:58
Django objects.filter() variable column #django #python #orm #database #variable #hacks
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.
Foobars.objects.filter(**{'bar__icontains': 'foo'})
@mrWinston
mrWinston / getProcessCpuLoad.java
Last active February 2, 2016 11:57
Get the CPU-usage of the process calling the method #java #Mbeans #cpu #utiilities
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details.
*/
public static double getProcessCpuLoad() throws MalformedObjectNameException, ReflectionException, InstanceNotFoundException {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
@mrWinston
mrWinston / main.js
Last active February 2, 2016 11:57
Simple Javascript OOP #javascript #nodejs #oop #object
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details.
*/
// import Object
var object = require("./object.js");
//init object
@mrWinston
mrWinston / openWebPage.java
Last active May 6, 2016 09:21
Open Browser window in Java #Java #browser #Runtime #webpage
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details.
*/
public static void openWebpage(String url, String... browsers) throws IOException {
String os = System.getProperty("os.name").toLowerCase();
@mrWinston
mrWinston / bash_case_insensitive_autocomplete
Created May 3, 2016 09:42
Enable Case Insensitive Autocompletion Bash #bash #shell #autocomplete #tipp #quick
#taken from: http://askubuntu.com/questions/87061/can-i-make-tab-auto-completion-case-insensitive-in-the-terminal
# If ~./inputrc doesn't exist yet, first include the original /etc/inputrc so we don't override it
if [ ! -a ~/.inputrc ]; then echo "\$include /etc/inputrc" > ~/.inputrc; fi
# Add option to ~/.inputrc to enable case-insensitive tab completion
echo "set completion-ignore-case On" >> ~/.inputrc
@mrWinston
mrWinston / GeneralTest.java
Last active July 13, 2016 13:46
Barebone junit Testfile #java #junit #test
/* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details.
*/
import junit.framework.TestCase;
import org.junit.After;
import org.junit.Before;
@mrWinston
mrWinston / List_Files_bigger
Last active March 9, 2017 11:47
LIst all file larger than 10Megabytes in current Dir recursively #bash #admin #search
find ./ -size +10M -exec ls -lh {} \;
@mrWinston
mrWinston / search_through_files
Created March 9, 2017 11:47
Searches through all files in the current dir for occurence of <search_term> #bash #search #admin
grep -rniI <search_term> .
@mrWinston
mrWinston / docker_pipelines_python_test
Created March 9, 2017 11:49
Start python Docker Container for testing bitbucket pipelines #docker #devops #pipelines #testing #shell
sudo docker run -it --volume=$(pwd):/localDebugRepo --workdir="/localDebugRepo" --memory=4g --entrypoint=/bin/bash python:2.7