Skip to content

Instantly share code, notes, and snippets.

View anchoo2kewl's full-sized avatar

Anshuman Biswas anchoo2kewl

View GitHub Profile
@anchoo2kewl
anchoo2kewl / mateAutoLogin
Created October 16, 2016 14:30
Allow a user to autologin on Ubuntu Mate (useful for RPI)
#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 October 5, 2016 03:49
setting up openstack on my bluemix machine
###################################################
# 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 August 17, 2016 16:29
Enum in Java for Error codes with descriptions
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;
# Controller configuration
[[local|localrc]]
DEST=/opt/stack
SERVICE_TOKEN=passwordToken
ADMIN_PASSWORD=password
MYSQL_PASSWORD=password
SERVICE_PASSWORD=password
DATABASE_PASSWORD=password
./letsencrypt-auto certonly -a manual --rsa-key-size 4096 --email abc@abc.com -d abc.com
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
sudo update-rc.d -f service defaults
sudo update-rc.d service enable
@anchoo2kewl
anchoo2kewl / copy.vba
Created April 27, 2015 22:24
Copying values when IDs match
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 August 26, 2014 14:11
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.
#/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 August 29, 2015 14:01
Delete all the duplicate entries from a table
DELETE FROM xyz where id in ( SELECT id from (SELECT id
FROM xyz
GROUP BY
name
HAVING COUNT(*) > 1) as newXYZ)