Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Video Tag</title>
<style>
figure {
text-align: center;
}
@alexandrinos
alexandrinos / gitconfig_path.txt
Last active December 4, 2015 13:21
git config global,system,local config .gitconfig in win7 /linux
git config -l (--system ?! ) -> C:\Users\All Users\Application Data\Git\config
git config --global -l -> C:\Users\Administrator\.gitconfig
git config --local -l -> project\.git\config
*********************
Linux
@alexandrinos
alexandrinos / vagrant.sh
Last active December 27, 2015 21:25
Vagrant - create a vagrant base box from another
#fire up a new box
vagrant init hashicorp/precise64
vagrant up
#optional customization in the vm
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install vim
sudo apt-get install apache2
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
@alexandrinos
alexandrinos / add_public_key_to_authorized
Last active December 27, 2015 15:32
Usefull commands network, environment Linux
#see https://help.ubuntu.com/community/SSH/OpenSSH/Keys
#add a public key to the authorized_keys on the server, if authorized_keys already exist on the server
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
#add a public key to the authorized_keys on the server, if authorized_keys not exist
cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"
#ssh-copy-id doesn't work here on Ubuntu with Myngw64 Win7
#use extended variant,for permissions issues
host=user@]machine;
ssh $host 'mkdir -pm 700 ~/.ssh; echo ' $key ' >> ~/.ssh/authorized_keys ; chmod 600 ~/.ssh/authorized_keys'
@alexandrinos
alexandrinos / windowsnetworking.bat
Last active January 3, 2023 03:24
Windows - Firewall / PortForwarding / Network
# ------------------ NETSH ---------------
#
#for help: $ netsh /?
#NETSTAT
#
#usefull
netstat -bn
@alexandrinos
alexandrinos / samba_ubuntu_win7
Last active December 22, 2017 23:57
Samba - Sharing Files with Win 7
sudo apt-get update
sudo apt-get install samba
#we need a different username and password for sambaserver
#for convenience, the user and passsword could be same as the username we are logged in linux
sudo smbpasswd -a <user_name>
#optional if the user is not the owner of the folder
#if apache and the user has is not owner(usually root) we need to chmod with and chown
#sudo chmod 2775 /var/www -R
#sudo chown root:<user_name> /var/www
sudo chown <user_name> /var/opt/folder
@alexandrinos
alexandrinos / infos_sharing_win7
Created December 24, 2015 18:40
Windows 7- PUBLIC PRIVATE DOMAIN aka PUBLIC HOME WORK
Difference between Home,Work,Public is about SHARING policy.
Public to be used when using a public Internet connection, for example
"Public" Network Profile: -more secure
- turn off sharing and not allow others to see your computer
"Home" Network- win7 network.Mixed XP,Linux or Max could be dangerous
-like an open network, joined by a SINGLE password and supports media sharing
"Work" Network- is XP style file sharing- with username and pass to connect to other comps
-is safe because is controlled by user account and share permissions, for example
in mixed OSs cases.
@alexandrinos
alexandrinos / firewall.ps1
Created December 25, 2015 12:26
Firewall info -open ports etc with Powershell
Function Get-EnabledRules
{
Param($profile)
$rules = (New-Object -comObject HNetCfg.FwPolicy2).rules
$rules = $rules | where-object {$_.Enabled -eq $true}
$rules = $rules | where-object {$_.Profiles -bAND $profile}
$rules
}
$networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}"))
@alexandrinos
alexandrinos / language.sh
Last active December 25, 2015 19:36
Language change keyboard Linux
#show language
locale
#change keyboard quickly
loadkeys de
#for X
setxkbmap de
#system wide, if ubuntu
sudo dpkg-reconfigure console-setup
#toggle us de
setxkbmap -option grp:alt_shift_toggle us,de
@alexandrinos
alexandrinos / firewall.sh
Created December 27, 2015 00:38
Firewal Linux aka iptables
#show all rules in a table ; you can use alternatively -L
sudo iptables -S
#show rule number in each of the 3 possible cases: INPUT OUTPUT FORWARD
sudo iptables -L --line-numbers
#delete a rule with a number; syntax: iptables -D <OUTPUT|INPUT|FORWARD> <line_number>
sudo iptables -D OUTPUT 3
#delete all rules in a chain ;chain= INPUT, OUTPUT or FORWARD
sudo iptables -F INPUT
#