Skip to content

Instantly share code, notes, and snippets.

@mtask
mtask / clamav.md
Last active September 18, 2015 11:07
ClamAV basic usage

##Clamav basic usage

  • Update db:

$ sudo freshclam

  • Basic scan:

$ clamscan OPTIONS File/Folder

@mtask
mtask / gist:ef03f836084516862f7217ac09ae3bbd
Created May 12, 2016 16:17
Python3 multi column print
#Creating big list
l = []
for i in range(255):
l.append(i)
#Print list in three columns
count = 1
for a in l:
if count % 3 == 0:
print(a)
<?xml version="1.0"?>
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
<resistance>
<strength>10</strength>
<screen_edge_strength>30</screen_edge_strength>
</resistance>
<focus>
<focusNew>yes</focusNew>
<!-- always try to focus new windows when they appear. other rules do
apply -->
@mtask
mtask / remjava.sh
Created November 30, 2016 20:34
Uninstall java completly
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove
sudo apt-get -y autoremove
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf
sudo rm -rf /usr/lib/jvm/*
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done
sudo updatedb
sudo locate -b '\pack200'
#http://askubuntu.com/questions/84483/how-to-completely-uninstall-java
@mtask
mtask / 0_reuse_code.js
Created December 1, 2016 19:50
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mtask
mtask / mysqlstatements.py
Last active January 16, 2017 06:45
Generate MySQL-statements without server connection.
from sqlalchemy.dialects import mysql
from sqlalchemy import Integer, Column, update, insert, MetaData, Table
from sqlalchemy.schema import CreateTable
def createtables():
tables = []
tabledict = {}
metadata=MetaData()
@mtask
mtask / pypervasive.py
Created January 15, 2017 21:42
Connect pervasive DB Pyodbc
import pyodbc
db = pyodbc.connect('Driver={Pervasive ODBC Client Interface};ServerName=MyServer;dbq=@DB;')
cursor = db.cursor()
cursor.execute("SELECT Id FROM TABLE")
for row in cursor.fetchall():
print row
db.close()
@mtask
mtask / ctypesexample.py
Last active May 7, 2017 07:44
Python Ctypes Windows examples
from ctypes import *
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms645505(v=vs.85).aspx
######################
# Yes/No msg box
#####################
a = windll.user32.MessageBoxW(0, "Hello\n", "The Title\n",4)
@mtask
mtask / ublocaldns.txt
Created August 19, 2017 09:38
Disable local dns ubuntu
Source: https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu
Disable the systemd-resolved service and stop it:
sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop
Put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:
dns=default
Delete the symlink /etc/resolv.conf
@mtask
mtask / README.md
Created March 20, 2019 18:48 — forked from jeanlescure/README.md
Ubuntu/Debian Offline Repository Creation

Ubuntu/Debian Offline Repository Creation Gist

When I googled how to create my own offline repository of packages for use in an offline Ubuntu/Debian machine, the results where disheartening and the steps to be taken scattered all over the place.

The files within this gist will allow you to:

  • Download specific apt-get packages... with dependencies included!
  • Create a Packages.gz file so that you can add the repository folder you create to the target machine's /etc/apt/sources.list file.

Before using