Skip to content

Instantly share code, notes, and snippets.

View kasramp's full-sized avatar
:octocat:
Chasing bugs

Kasra Madadipouya kasramp

:octocat:
Chasing bugs
View GitHub Profile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@kasramp
kasramp / host_vbox_custom_resolution.sh
Last active September 1, 2022 12:59
Set screen resolution on Virtualbox (host machine)
#!/bin/sh
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Pass VBox machine name and screen resolution"
echo "Example: 'OpenBSD New' '1920x1080x32'"
exit 1
fi
VBoxManage setextradata "$1" CustomVideoMode1 "$2"
@kasramp
kasramp / openbsd_vbox_resolution.sh
Last active September 1, 2022 12:59
Set OpenBSD screen resolution on Virtualbox
#!/bin/sh
# inspired by https://www.tumfatig.net/20190131/customized-resolution-for-openbsd-in-virtualbox/
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
mkdir -p /etc/X11/xorg.conf.d
@kasramp
kasramp / git_submodules.md
Created October 27, 2019 20:03 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@kasramp
kasramp / StudentServiceJUnit4Test.java
Last active October 5, 2018 05:51
A test class written in JUnit4
import com.madadipouya.junit5.service.StudentService;
import com.madadipouya.junit5.service.CourseService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.Mockito.*;
@kasramp
kasramp / settings.xml
Created July 8, 2016 07:01
OpenShift settings.xml
<settings>
<localRepository>$OPENSHIFT_DATA_DIR</localRepository>
</settings>
@kasramp
kasramp / stop
Created July 8, 2016 06:57
OpenShift stop script
#!/bin/bash
source $OPENSHIFT_CARTRIDGE_SDK_BASH
PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }')
if [ -z "$PID" ]
then
client_result "Application is already stopped"
else
kill $PID
fi
@kasramp
kasramp / start
Last active August 21, 2016 02:50
OpenShift start script
#!/bin/bash
export JAVA_HOME=$OPENSHIFT_DATA_DIR/jdk1.8.0_65
export PATH=$JAVA_HOME/bin:$PATH
$OPENSHIFT_DATA_DIR/apache-maven-3.3.9/bin/mvn -f $OPENSHIFT_REPO_DIR/pom.xml clean package -s $OPENSHIFT_REPO_DIR/.openshift/settings.xml
nohup java -jar -Dserver.port=${OPENSHIFT_DIY_PORT} -Dserver.address=${OPENSHIFT_DIY_IP} $OPENSHIFT_REPO_DIR/target/*.jar > ${OPENSHIFT_DIY_LOG_DIR}/bootjava8.log 2>&1 &
@kasramp
kasramp / build
Last active August 21, 2016 02:49
OpenShift build script
#!/bin/bash
cd $OPENSHIFT_DATA_DIR
if [ ! -d apache-maven-3.3.9 ]; then
wget http://www.eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar -zxf apache-maven-3.3.9-bin.tar.gz
fi
if [ ! -d jdk1.8.0_65 ]; then
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u65-b16/jdk-8u65-linux-i586.tar.gz
@kasramp
kasramp / equation.tex
Last active June 12, 2016 05:14
Latex equation
[latex]sim(a,b)=\frac{\sum_{p\epsilon P}({r_{a,p}}-\bar{r}_{a})(r_{b,p}-\bar{r}_{b})}{\sqrt{\sum _{p\epsilon P}(r_{a,p}-\bar{r}_{a})^{2}}{\sqrt{\sum _{p\epsilon P}(r_{b,p}-\bar{r}_{b})^{2}}}}[/latex]