Skip to content

Instantly share code, notes, and snippets.

Avatar

Anshuman Biswas anchoo2kewl

View GitHub Profile
@anchoo2kewl
anchoo2kewl / mateAutoLogin
Created Oct 16, 2016
Allow a user to autologin on Ubuntu Mate (useful for RPI)
View mateAutoLogin
#Create the directory:
sudo mkdir /etc/systemd/system/getty@tty1.service.d
#Create file:
sudo vim /etc/systemd/system/getty@tty1.service.d/autologin.conf
#Insert:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin YOURUSERNAMEHERE --noclear %I 38400 linux
@anchoo2kewl
anchoo2kewl / devstack_setup.txt
Created Oct 5, 2016
setting up openstack on my bluemix machine
View devstack_setup.txt
###################################################
# This is for running devstack on Ubuntu 16.04
# as of September 9, 2016, (near the end of Newton)
###################################################
# This was tested using VMWare Fusion 8.1.1 on OSX, an alternative is VirtualBox
# Download VirtualBox latest 4.xx https://www.virtualbox.org/wiki/Download_Old_Builds_4_3
# Download Ubuntu 16.04 http://releases.ubuntu.com/16.04/ubuntu-16.04-desktop-amd64.iso
# Create a Ubuntu VM, 64 bit. Give it 4-6 GB RAM, 25-40 GB HD, 2-3 processors
# Boot up the VM, install ubuntu, use the default settings.
@anchoo2kewl
anchoo2kewl / JavaEnum
Created Aug 17, 2016
Enum in Java for Error codes with descriptions
View JavaEnum
public enum test {
A(-1, "Text 1"),
B(-2, "Text 2");
private final int code;
private final String description;
private test(int code, String description) {
this.code = code;
this.description = description;
View localrc
# Controller configuration
[[local|localrc]]
DEST=/opt/stack
SERVICE_TOKEN=passwordToken
ADMIN_PASSWORD=password
MYSQL_PASSWORD=password
SERVICE_PASSWORD=password
DATABASE_PASSWORD=password
View letsEncrypt
./letsencrypt-auto certonly -a manual --rsa-key-size 4096 --email abc@abc.com -d abc.com
View rdesktop.sh
sudo apt-get update
sudo apt-get install build-essential libx11-dev libssl-dev -y libgssglue-dev libpcsclite-dev
tar zxvf rdesktop-1.8.3.tar.gz
cd rdesktop-1.8.3
./bootstrap
./configure
make
sudo make install
View Auto-start a service in Ubuntu
sudo update-rc.d -f service defaults
sudo update-rc.d service enable
@anchoo2kewl
anchoo2kewl / copy.vba
Created Apr 27, 2015
Copying values when IDs match
View copy.vba
Private Sub Migrate()
For i = 3 To 26
For j = 3 To 62
If Sheets("final").Cells(j, 1) = Cells(i, 1).Value Or Sheets("final").Cells(j, 1) = Cells(i, 2).Value Or Sheets("final").Cells(j, 1) = Cells(i, 3).Value Then
Sheets("final").Cells(j, 7) = Cells(i, 4).Value
Sheets("final").Cells(j, 8) = Cells(i, 5).Value
End If
Next j
Next i
End Sub
@anchoo2kewl
anchoo2kewl / createUser
Created Aug 26, 2014
This script helps create a new email account in postfix and dovecot. The domain is hardcoded for my needs because its faster but one may pass the domain as a parameter.
View createUser
#/bin/bash
# chkconfig: 2345 50 70
SUCCESS=0
FAILURE=1
#
if [ $# -ne 1 ]
then
echo "Usage: createUser {username}"
exit $FAILURE
fi
@anchoo2kewl
anchoo2kewl / delete.sql
Last active Aug 29, 2015
Delete all the duplicate entries from a table
View delete.sql
DELETE FROM xyz where id in ( SELECT id from (SELECT id
FROM xyz
GROUP BY
name
HAVING COUNT(*) > 1) as newXYZ)