Skip to content

Instantly share code, notes, and snippets.

View pete911's full-sized avatar
🏠
Working from home

Peter Reisinger pete911

🏠
Working from home
View GitHub Profile
`sudo nmap -sP 192.168.1.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'` update `192.168.1.*` accordingly
@pete911
pete911 / gist:0d2dfdd33a6cd16b2519
Created September 24, 2014 10:03
remove System-V script link
sudo update-rc.d -f [app_name] remove
@pete911
pete911 / ssh keys
Last active August 29, 2015 13:57
ssh key based authentication
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa -b 4096 -f ~/.ssh/<key_name>
ssh-copy-id -i ~/.ssh/<key_name>.pub <username>@<host>
# add following entry to ~/.ssh/config file
Host <host|alias>
HostName <host|ip>
@pete911
pete911 / knife-ec2
Last active January 4, 2016 19:09
chef - knife-ec2 setup
--- install rvm ---
# get and execute rvm and source it
curl -sSL https://get.rvm.io | bash -s stable
source .rvm/scripts/rvm
# install ruby 2.1.0 and use it
rvm install ruby-2.1.0
rvm use 2.1.0
@pete911
pete911 / Spring Resources
Last active January 3, 2016 23:59
Java - get resources from classpath
import org.springframework.core.io.Resource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
...
PathMatchingResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resourceResolver.getResources("conf/**/*.properties");
Resource resource = resources[0];
@pete911
pete911 / gist:6411270
Created September 2, 2013 10:04
key based authentication
ssh-keygen -t rsa
ssh-copy-id -i .ssh/id_rsa.pub username:password@remotehost
@pete911
pete911 / gist:6219918
Last active December 31, 2020 00:39
jenkins with private github projects
- login to jenkins box (ssh)
- switch user to jenkins "sudo su -s /bin/bash jenkins"
- go to jenkins home directory "cd ~"
- generate keys (you need separate pair per github private project as the projects are on the same domain)
- "ssh-keygen -t rsa -f ~/.ssh/id_rsa_<project>" (replace <project> with your project name)
- repeat this for every github project
- crate "config" file in .ssh dir - "vim ~/.ssh/config" with the following content:
# <project1>
Host github.com-<project1>
HostName github.com
@pete911
pete911 / tomcat manager deploy
Last active October 12, 2022 19:13
tomcat - deploy war files using curl
# deploy under "path" context path
curl --upload-file appplication-0.1-1.war "http://tomcat:tomcat@localhost:8080/manager/deploy?path=/application-0.1-1
# undeploy
curl "http://tomcat:tomcat@localhost:8080/manager/undeploy?path=/application-0.1-1"
# ! tomcat7 uses /manager/text/undeploy and /manager/text/deploy paths
# tomcat6-admin (debian) or tomcat6-admin-webapps (rhel) has to be installed
# tomcat-users.xml has to be setup with user that has admin, manager and manager-script roles
@pete911
pete911 / big O
Created June 25, 2013 15:30
big O cheat sheet
http://bigocheatsheet.com/
@pete911
pete911 / hiring hacks for startup
Created June 13, 2013 12:40
hiring hacks for startup
http://recruitloop.com/blog/hiring-hacks-for-startups/