Skip to content

Instantly share code, notes, and snippets.

@bitIO
Last active August 29, 2015 14:04
Show Gist options
  • Save bitIO/fdd63d6571b32b0cfb41 to your computer and use it in GitHub Desktop.
Save bitIO/fdd63d6571b32b0cfb41 to your computer and use it in GitHub Desktop.
Linux common tasks
#!/bin/bash
# posts a file named body.json to url
curl -H "Content-Type: application/json" --data-binary @body.json http://localhost:8080/ui/webapp/conf
#!/bin/sh
USER_DATE=JUN-08-2011
# first day of the month
FIRST_DAY_OF_MONTH=$(date -d "$USER_DATE" +%b-01-%Y)
PREVIOUS_DAY=$(date -d "$USER_DATE -1 days" +%b-%d-%Y)
# last day of the month
FIRST_DAY_NEXT_MONTH=$(date -d "$USER_DATE +1 month" +%b-01-%Y)
LAST_DAY_OF_MONTH=$(date -d "$FIRST_DAY_NEXT_MONTH -1 day" +%b-%d-%Y)
echo "User date: $USER_DATE"
echo "1. First day of the month: $FIRST_DAY_OF_MONTH"
echo "2. Previous day: $PREVIOUS_DAY"
echo "3. Last day of the month: $LAST_DAY_OF_MONTH"
#!/bin/bash
kernel="2.6.39";
distro="xyz";
cat > /etc/myconfig.conf << EOL
${kernel}
${distro}
EOL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment