Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Mads Madsen 19:06 on October 13, 2024 Permalink | Reply
    Tags: , mdadm, Software RAID, Ubuntu   

    Join already setup software raid 

    When moving disks from one host to another, I wanted to join the raid already setup on the disks.

    On the new host ensure mdadm is already installed.

    $ sudo apt-get install mdadm

    Scan for the raid:

    $ sudo mdadm --detail --scan

    Check that it was found successfully.

    Persist the found raid in /etc/mdadm/mdadm.conf:

    $ sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf

    Update initramfs:

    $ sudo update-initramfs -u

    Add the raid to /etc/fstab so it’ll be mounted on boot:

    /dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0

     
  • Mads Madsen 10:29 on November 12, 2020 Permalink | Reply
    Tags: aws, docker   

    Run aws lambda locally 

    Create simple Dockerfile:

    The above Dockerfile is for nodejs lambdas, check https://github.com/lambci/docker-lambda for more docker images.

    Build the above docker image:

    Run the docker image:

     
  • Mads Madsen 10:42 on September 10, 2020 Permalink | Reply
    Tags: bash, environment, export   

    Export environment variables without exposing them to command history 

    Environment file example:

    Export command:

     
  • Mads Madsen 18:51 on April 7, 2019 Permalink | Reply
    Tags: ,   

    Permission denied (publickey). fatal: Could not read from remote repository. 

    On mac os, fix:

     
  • Mads Madsen 13:16 on April 6, 2019 Permalink | Reply
    Tags:   

    Git Error: Could could not read Username for ‘https://github.com’: terminal prompts disabled 

    If you have enabled 2FA on github, you can no longer use https:// in the terminal, run the command below, to always force ssh when trying to access github from the terminal.

     
  • Mads Madsen 13:30 on February 16, 2019 Permalink | Reply
    Tags: , Pi zero, Raspberry PI   

    Rename default pi user 

    After installing Raspbian Lite on a Raspberry PI, the default user pi is a liability. To fix this, a possibility is to create a new user and delete the old pi user, but I like recycling, so I’ll just rename the user.

    First we need to allow root login over ssh;

    1. Add PermitRootLogin yes to /etc/ssh/sshd_config
    2. Change the password of the root user $ sudo passwd root
    3. Restart ssh $ sudo service ssh restart

    Second login to the raspberry with root and execute the following;

    1. Kill all processes started by pi
      1. $ pkill -u pi
      2. $ pkill -9 -u pi
    2. $ usermod -l new_username pi
    3. $ groupmod -n new_username pi
    4. $ usermod -d /home/new_username new_username
    5. Remove PermitRootLogin yes from /etc/ssh/sshd_config
    6. Remove the root password $ passwd -d root
    7. Restart the raspberry pi $ reboot

     
  • Mads Madsen 01:44 on June 18, 2017 Permalink | Reply
    Tags: , rsyslog   

    Make rsyslog log a specific program into its own log file and stop logging into syslog 

     
  • Mads Madsen 09:58 on June 15, 2017 Permalink | Reply
    Tags: npm, scope   

    Setup NPM to use a private registry for scoped packages 

     

     
  • Mads Madsen 11:34 on October 23, 2014 Permalink | Reply
    Tags:   

    Get Last Day of the Month in Python 

     
  • Mads Madsen 17:07 on March 26, 2014 Permalink | Reply
    Tags: android, disable 2g, force 3g, force 4g, kitkat   

    Force 3G or 4G Android Kitkat 4.4 

    In the dialer type in *#*#4636#*#*.

    Go to Phone information and scroll down to ‘Set preferred network type’ and set it to ‘LTE/CDMA’.
    And now your phone will not try to connect to EDGE/2G.

    Note this mode completely disables GSM/EDGE/2G so when the phone is out of reach from a 3G tower, you will not be able to make phone calls. In this case just switch back to a GSM mode.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel