Skip to content

Instantly share code, notes, and snippets.

View hapylestat's full-sized avatar
:octocat:
Looking for time compression tool

hapylestat

:octocat:
Looking for time compression tool
View GitHub Profile
@hapylestat
hapylestat / scan_net.sh
Created August 25, 2013 01:12
Fast network ping scan in bash (queried)
#!/bin/sh
NET=1.1.1.
FROM=2
TO=254
IF=eth1
sSTOP=0
control_c(){
echo Catch interrupt signal, aborting...
sSTOP=1
@hapylestat
hapylestat / yget
Created September 3, 2013 08:19
simple youtube-dl automatization, initital version
#!/bin/bash
youtube-dl -F "$1"
read -e -p "Select preffered format:" FRMT
FILE=`youtube-dl -f $FRMT --get-filename "$1"`
youtube-dl -f $FRMT "$1"
ffmpeg -i "$FILE" -c copy -copyts "${FILE}.mp4"
chown user:user "$FILE"
chown user:user "${FILE}.mp4"
@hapylestat
hapylestat / ping-test.ps1
Created November 13, 2013 23:57
Network pinger, make colored dots to help visual analyze a quality of network connection over time
#==========variables
$h="8.8.8.8"
$ping=New-object System.Net.NetworkInformation.Ping
$window=(get-host).UI.RawUI
$c=0;
#==========/variables
Write-Host "Begin => "
while ($True){
@hapylestat
hapylestat / mount_drive.ps1
Created July 8, 2014 12:08
map network drive
################################################
# Map shares #
# Author: H.L. #
# Version: 0.3 #
# Description: map shares to the system #
################################################
#############################what's new
#--v0.3--
#- Mount fix, while described multiple shares
@hapylestat
hapylestat / shares.bash
Last active August 29, 2015 14:05
Mount smb shares with rw access for simple user using cifs (not gmount). Should be executed under root.
#!/bin/bash
#######################################################################
# Shell script #
# Author: H.L. #
# TPL Version: 0.1 #
# Script for https://github.com/hapylestat/bashtools/tree/master/lib #
#######################################################################
#========================Global variables
APPVER="0.1b"
@hapylestat
hapylestat / curl_sample.py
Created December 17, 2014 01:06
Python CURL alternative
import sys
if sys.version_info.major == 3:
from urllib.request import HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, Request, build_opener
from urllib.parse import urlencode
else:
from urllib2 import HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, Request, build_opener
from urllib import urlencode
@hapylestat
hapylestat / flume_agent_generator.py
Created January 20, 2015 11:09
flume_agent_generator.py
#!/usr/bin/env python
tpl_data = """
# Name the components on this agent
a{0}.sources = src{0}
a{0}.sinks = sink{0}
a{0}.channels = c{0}
# Use a channel which buffers events in memory
a{0}.channels.c{0}.type = memory
@hapylestat
hapylestat / hdd_list
Last active August 29, 2015 14:20
Get a list of hard_disks with their health status (smartctl required)
#!/bin/bash
COLOR_BEGIN="\033["
COLOR_RED="${COLOR_BEGIN}0;31m"
COLOR_ITEM="${COLOR_BEGIN}1;38;05;214m"
COLOR_VALUE="${COLOR_BEGIN}1;38;05;110m"
COLOR_END="\033[0m"
mypath=/sys/block
temp=/tmp/hddlist.tmp
@hapylestat
hapylestat / switch_lang.sh
Last active August 29, 2015 14:21
Switch lang using ibus daemon
#!/bin/dash
CURRENT_LANG=$(ibus engine)
FLAG_LOCATION=/usr/share/xfce4/xkb/flags
RU="xkb:ru::rus"
EN="xkb:us::eng"
if [ "$CURRENT_LANG" = "$RU" ]; then
notify-send -i ${FLAG_LOCATION}/us.svg -t 5000 "Keyboard layout" "RU -> EN"
ibus engine ${EN}
@hapylestat
hapylestat / progressbar.py
Created August 10, 2015 14:48
Paint progressbar
import sys
import shutil
class Progressbar(object):
def __init__(self, text: str, width: int):
self._text = text
self._width = width
self._max = 0
c = shutil.get_terminal_size(fallback=(80, 24))