Categories
java netbeans

Netbeans is awesome!

over the years, spent more time dealing with eclipse bugs and issues instead of my work, so it was time to move on which is the exact reason why I left microsoftland years ago.
Netbeans is now my “go to” editor for java, c++ and big projects. Listed will be reminders to how to use neat features in netbeans. shortcuts.

 JAVA class - cool netbeans shortcuts 

ALT-Insert will pull up a menu to let netbeans do get setters
sout - TAB will do the System.println.

... more to come.
Categories
Php

php debugging

for debugging php programs
1. get into the php.ini file
2. set log_errors = On
3, fedora: restart php-fpm

Categories
Docker Mariadb

mysqlimport

When importing a data file into mysql/mariadb, I found that the below line works:


 docker exec -it some-mariadb mysqlimport -u root -pmy-secret-pw --local --ignore-lines 1 --columns month,day,time,username,ip,port,notes hacktrack  ./data/raw/ssh_failure.tab.txt
Categories
Development

Projects

I have over 400 projects in my src directory that I have worked on, played around with or tested.   I forgot what most of these do so in my spare time, will add the git README.md file into each directory.

The new format for this document will be:


Project:
Hacker Tracker

Description:
Casualcoder.net gets lots of traffic testing the ssh. This program goes through the auth.log file for the previous day to find who and place this info into a db for analzying

DateCreated:
20190528

git:no jenkins:no docker:no

Directory:
/src/cplus-hacktrack

Keywords:
c++ mongo bash

I think this will make it easier to find snippets or ideas when I need them.

the git: line will be a quick yes or no if the tools I use often are being used in this project.

I found that for me, naming the directory with

 

Categories
Linux

linux distro and version

which distro and version am I running?  If you run a few, try this command:

lsb_release -a

Categories
Docker Mariadb

docker mysql load dump file

This is how to load a sql dump file from directory to a mysql database in a container.

Make sure you have a volume set up with the directory you keep your sql files in.  In my case, I have a directory called “/data/raw” that I keep all my csv and sql files in for loading and dumping.

docker command

sudo docker run --name some-mariadb -v /data/mysql:/var/lib/mysql -v/data/raw:/data/raw-e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:latest

or…

docker-compose yaml file.


  mariadb:
    image: mariadb
    container_name: some-mariadb
    environment:
    - "MYSQL_ROOT_PASSWORD:my-secret-pw"
    volumes:
    -  /data/mysql:/var/lib/mysql
    - /data/raw:/data/raw
    ports:
    - 3306:3306

I change the directory to my /data/raw directory on my linux box that I’m running the container on.

To load a file into mysql/mariadb, open mysql from the command line:


docker exec -it  some-mariadb mysql -u root -pmy-secret-pw my-database

 

and then…


MariaDB []> source /data/raw/dump-file_data.sql

 

I use the same method for postgres

Categories
Mariadb Uncategorized

mysql add user

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Categories
Redis

redis setup

setting up redis-server on casualcoder was straightforward.
you need:

redis-server and redis-cli.
you can test the server by using:

/redis-server --port 6380 --slaveof 127.0.0.1 6379

run the service and go:
the docs on the redis site recommend to update the config:


/etc/redis/redis.conf
    appendonly yes
    appendfsync everysec

Once redis is running the way you like, start er up. you can

sudo service redis-server restart

or add to startup by

systemctl enable redis-server
Categories
Links

Cool Links!

djamware : This guy has an awesome example on sequelize, postgres and a wonderful controller/model setup.

 

Categories
Git

Git change branch name

Very cool.  I created a branch to work on one feature and did something completely different. Going to rename branch and and blow away branch on remote


git branch -m old_branch new_branch         # Rename branch locally    

git push origin :old_branch                 # Delete the old branch    

git push --set-upstream origin new_branch   # Push the new branch, set local branch to track the new remote

Thanks to https://www.w3docs.com/snippets/git/how-to-rename-git-local-and-remote-branches.html for this one!