Tags » Bash

redis: list all the keys

Problem
You want to list all the keys in your Redis database. Or, you want to list just some of them.

Solution
See the documentation… 18 more words

Bash

Python locale error: unsupported locale setting

Sometimes we are getting local error and cannot install packages via pip.

I found a solution to get rid of it.

Run this command from your command line interface. 75 more words

Ubuntu

Installing the bash shell in Windows 10 Insider Preview

Maybe some of you have heard by now, but you can run a bash shell from within Windows Powershell. Check out the sources at the end of this post for more info, but read along to see me install it on one of my Windows 10 machines. 426 more words

Linux

Downloader Python Tkinter GUI for wget,youtube-dl,git clone commands

#!/usr/bin/python
from Tkinter import Tk, Label, Button, Menu, Entry, Frame, IntVar, Radiobutton, Text
import subprocess 
import tkMessageBox
from progress.bar import Bar

class Downloader:
    def __init__(self, master, *argv, **kwargs):
        self.master = master
        master.title("Downloader")
        
        self.download_label = Label(master, text="Paste the Link",width="20")
        self.download_label.grid(row=0,column=0,sticky="w")
        self.e = Entry(master,width="20")
        self.e.grid(row=1,column=0,sticky="w")
        
        self.down = Button(master, text="Website", width="5", command=self.download_website)
        self.down.grid(row=2,column=0,sticky="w")
        self.down2 = Button(master, text="YouTube", width="5", command=self.download_youtube)
        self.down2.grid(row=3, column=0, sticky="w")
        self.down3 = Button(master, text="GitHub", width="5", command=self.download_github)
        self.down3.grid(row=4, column=0, sticky="w")
        self.down4 = Button(master, text="Clear", width="5", command=self.download_clear)
        self.down4.grid(row=5, column=0, sticky="w")
        
#Downloader
    def download_website(self):
        if len(self.e.get()) == 0:
            tkMessageBox.showinfo(title='Download', \
            message='You did not enter something for downloading,please try again')
        else:
            subprocess.call(['wget','--limit-rate=200k','--no-clobber','--convert-links','--random-wait','-r','-p','-E','-e','robots=off','-U','mozilla',self.e.get(),'-P','download/website'])
            tkMessageBox.showinfo(title='Download', \
            message='Download completed')
             
    def download_youtube(self): 
        if len(self.e.get()) == 0:
            tkMessageBox.showinfo(title='Download', \
            message='You did not enter something for downloading,please try again')
        else:
            #'/home/zero/pysysadmin/python-tool/download/youtube/%(title)s.%(id)s.%(ext)s'
            subprocess.call(['youtube-dl',self.e.get()]) #When i put '-o path' it doesn't work'
            tkMessageBox.showinfo(title='Download', \
            message='Download completed')
   
    def download_github(self): 
        if len(self.e.get()) == 0:
            tkMessageBox.showinfo(title='Download', \
            message='You did not enter something for downloading,please try again')
        else:
            subprocess.call(['git', 'clone', self.e.get(), 'download/github']) #When i put '-o path' it doesn't work'
            tkMessageBox.showinfo(title='Download', \
            message='Download completed')
    def download_clear(self):
        subprocess.call('clear')
        self.e.delete(0, "end")
##        
##    def on_button3(self):
##        self.e.delete(0, "end")
##        subprocess.call('clear')
##        
##    def on_button4(self):
##        self.search_entry.delete(0, "end")
##        subprocess.call('clear')
#Main 
root = Tk()
root.geometry("220x310+300+300")
downloader = Downloader(root)
root.mainloop()
Linux

Backup Python Tkinter GUI for rsync command

##From default rsync is adapted with the below options:
# -v increase verbosity
# -a archive mode; equals -rlptgoD (no -H,-A,-X)
# -z compress file data during the transfer
# -h output numbers in a human-readable format
# -u skip files that are newer on the receiver

#!/usr/bin/python
import os,ttk,subprocess,tkMessageBox,tkFileDialog
from Tkinter import *
#Tk,Label,Button,Frame,OptionMenu,Checkbutton,IntVar,StringVar,LabelFrame
##import Tkinter as tk

##Change the source paths with your own names
#Source
PYSYSADMIN = '/home/zero/pysysadmin'
DOWNLOADS = '/home/zero/Downloads'
DOCUMENTS = '/home/zero/Documents'
##Change the destination paths with your own names
#Destination
LOCAL = '/home/zero/BACKUP'
USB = '/media/zero/Transcend/PERSONAL/BACKUP'
GOOGLE_DRIVE = 'backup:drive'

class Backup:
    def __init__(self, master, *argv, **kwargs):
        self.master = master
        master.title("Backup")

        self.fromall = IntVar()
        self.toall = IntVar()       
        self.label_backup = Label(master, text="Backup...",font = "Times 12 bold")
        self.label_backup.grid(row=0,column=0,sticky="w")
        
        #Option Menu - Drop Down Choises
        self.var = StringVar(master)
        self.var.set('Source') # initial value
        
        #Change this options 'From All', 'Pysysadmin', 'Downloads', 'Documents' with your own names 
        self.option = OptionMenu(master, self.var, 'From All', 'Pysysadmin', 'Downloads', 'Documents')
        self.option.config(width=10) 
        #If you want to change the dimension of drop down menu,unfortunately you can't. 629 more words
Linux

How to deal with parameters in bash scripts like a pro

I use to develop bash scripts, and I usually have a problem with flags and parameters. I like to allow parameters like a pro: using the… 354 more words

Linux

tmux - Notes

I started using tmux. It is genuinely easier to use than screen. I have used screen for a while, but I never bothered to learn more commands. 364 more words

Bash