Skip to content

Instantly share code, notes, and snippets.

View electric380v's full-sized avatar

Sergii Kh electric380v

  • UA
  • 18:18 (UTC +03:00)
View GitHub Profile
@electric380v
electric380v / cygwin-config.sh
Created June 25, 2018 18:02
Cygwin base installation
# 1. Download cygwin setup-x86.exe from http://www.cygwin.com/setup-x86.exe.
# 2. Install with wget package.
# 3. Run cygwin.bat with Administrator rights
cd /tmp
# wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
wget https://github.com/Milly/apt-cyg/raw/master/apt-cyg --no-check-certificate
chmod +x apt-cyg
mv apt-cyg /bin/apt-cyg
apt-cyg update
@electric380v
electric380v / openvpn-install.sh
Created June 25, 2018 21:21
OpenVPN road warrior installer for Debian, Ubuntu and CentOS
#!/bin/bash
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS
# This script will work on Debian, Ubuntu, CentOS and probably other distros
# of the same families, although no support is offered for them. It isn't
# bulletproof but it will probably work if you simply want to setup a VPN on
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and
# universal as possible.
@electric380v
electric380v / check_openvpn.sh
Created June 27, 2018 09:23
Сheck Geteway
# #!/bin/bash
## Сheck Geteway
if ping -c 2 8.8.8.8 >/dev/null
then
date
echo "online"
else
echo "Offline"
systemctl restart openvpn@01
@electric380v
electric380v / ansible_install.sh
Created July 4, 2018 21:21
Install Ansible in cygwin windows
#!/bin/sh
type apt-cyg || exit
apt-cyg install git python-{jinja2,six,yaml}
git clone --depth 1 git://github.com/ansible/ansible
cd ansible
PATH+=:~+/bin
export PYTHONPATH=~+/lib
sleep 5
@electric380v
electric380v / commands.sh
Created July 27, 2018 10:29
A collection of commands
# Virtualbox: Mount the shared folder
sudo mount -t vboxsf temp Shared
# process listening on a port (e.g. 5000)
lsof -i :5000 # find the process
lsof -i :80 # find the program running on a port
kill -9 PID # kill process
sudo netstat -lpn |grep :5000
netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c # view list of connections and their states
ss -rota | less # list all connections and timers
@electric380v
electric380v / text.sh
Created July 27, 2018 10:33
Some useful text manipulation commands (sed, gawk, etc.)
# print the number of columns
gawk '{print NF}' file | sort -nu | tail -n 1
# Use head -n 1 for lowest column count, tail -n 1 for highest column count.
# print columns
gawk '{print $0}' file # all columns
gawk '{print $4}' file # 4th column
gawk -F "," '{print $2}' file # specific separator
# split a string with a delimiter into lines
@electric380v
electric380v / README.md
Created December 9, 2018 00:37 — forked from denji/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@electric380v
electric380v / Sublime Text 3 Serial key
Last active January 10, 2020 09:44
Sublime Text 3 Serial key build is 3176
### Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@electric380v
electric380v / Sublime Text My Settings
Created January 15, 2019 08:32
Sublime Text My Settings
Keymap (Windows Users):
[
{ "keys": ["alt+shift+f"], "command": "reindent" },
]
Settings:
{
"show_definitions": false,
"auto_complete": false,
"bold_folder_labels": true,
@electric380v
electric380v / Preferences.sublime-settings
Created January 15, 2019 09:13
Preferences.sublime-settings
{
"always_show_minimap_viewport": true,
"auto_complete": false,
"bold_folder_labels": true,
// "color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"fold_buttons": false,
"font_options":
[
"gray_antialias"
],