How To Tweet From CLI On Windows 10 w. Node.js

Always working from PowerShell, CMD, Git Bash, or Git Shell? Ever want to tweet from the command line while your pushing code to your Github repository? I was interested in doing this on my laptop, making it easy to tweet on the go while I’m coding away at a coffee shop. I’d like keep my phone face down or in my pocket to avoid distractions… But that urge to tweet happens to often. Windows Store Twitter app is crap, and Twitter.com in browser is always sluggish… Let’s just tweet from the command line!

Tweet from CLI with Node.js

1.) Download & Install Node.js

2.) Run cmd.exe or PowerShell. I prefer to use Git Bash.

3.) Install cli-tweet by typing this command in:

npm install cli-tweet -g

4.) Now we need to see where npm installed the npm_modules folder.
npm root
It will return a path that we need.


5.) Open File Explorer, Right Click “This PC” -> Properties, click Advanced system settings, then click Environment Variables. Copy and paste the path that npm root gave you into your Windows 10 Systems PATH.

6.) Close your CLI window and run it again in Administrative Mode.

7.) Type the following:
tweet config

8.) It will give you an authorization URL that you have to copy and paste into your browser. Once the page loads, login and authorize RaedsLab app and it will give you a token to enter.

9.) With cli-tweet configured, try typing

echo "Hello Universe" | tweet

Do you like this awesome cli tweet tool? Go star the repo over on Github! If you don’t want to use RaedsLab Twitter app, you can create your own Twitter app and clone cli-tweet repository. In main.js line 13-14 you should see the key and secret for your Twitter App. You can install cli-tweet with your own key with the command: npm install /path

Read More

BitTorrent SyncApp Alpha Testing

syncapp

Today, I received my invitation to alpha test BitTorrent SyncApp. I can only imagine the implications this will open up. Although Dropbox is safe, secure, and redundant, how safe is your files? SyncApp is interest, I generate a secret key and designate my “SyncApp” folder. I fire it up my laptop and install SyncApp.exe and punch in my secret key. Immediately, over 2,800+ files in my WordPress localhost is synced to my laptop. This afternoon, it’s synced to a 3rd box. I am interested in taking this to the next step and placing my files on a Linux server in California… with all my private git repositories. I wonder how well git will behave with SyncApp?

I think the most fascinating implication of SyncApp that I can brew in my mind is utilizing it over a Meshnet. Think of tying several Meshnet nodes in Bellingham and giving end users the “secret key” – madness. I wonder if there’s anyone in Bellingham that has already thrown up Meshnet nodes?

The next plan of actions with alpha testing BitTorrent SyncApp will be to tie all of my company files (.psd, .ai, .eps) between 3 computers and potentially a 4th. Perhaps my personal dedicated server down in California? Or maybe I should throw up an experimental Amazon EC2 with block storage? D: OMFG, way to excited.

Read More

Bash Script TimThumb Update [cPanel/WHM]

If your dealing with a large WordPress instance, I hope you have shell. Using plugins like Timthumb Vulnerability Scanner on small installations is great, however, on large installations the server might 503.

I had previously used bash scripts to detect outdated TimThumb using simple grep command and outputting the finding to a .txt file which I could cross reference during the update process. It’s become cumbersome to do this, I wanted to grab the updated timthumb version from the Google Code repository and update the files. With a quick Google search, I fould this simple script for cPanel users that can be modified to your distro. Props to DropDeadDick.com for sharing his script. <3 [bash] #! /bin/bash # Detects and updates timthumb.php to latest version for all cPanel users. # dropdeaddick.com latest=`lynx -source http://timthumb.googlecode.com/svn/trunk/timthumb.php |grep "define ('VERSION'" $file |cut -f4 -d"'"` if [ -z "$latest" ]; then echo "could not get latest timthumb release, aborting!" exit 1 fi for user in `awk -F':' '{ if ($3 > 499) print $0 }' /etc/passwd | grep home | cut -d':' -f1`; do for file in `find /home*/$user/public_html/ -type f ( -name 'thumb.php' -o -name 'timthumb.php' ) 2>/dev/null | tr ' ' '%'`; do file=`echo $file | tr '%' ' '` check=`grep -c "code.google.com/p/timthumb" "$file"` if [ -z "$check" ]; then break fi if [ "$check" -gt "0" ]; then version=`grep "define ('VERSION'" "$file" |cut -f4 -d"'"` if [ "$version" != "$latest" ]; then echo -e "e[1;31mWARNING version $versione[0m updating $file!" # rm -f $file #delete current file before replacing. wget -nv -t3 -T3 http://timthumb.googlecode.com/svn/trunk/timthumb.php -O "$file" chown $user: "$file" else echo -e "e[1;32mOK version $versione[0m skipping $file" fi fi done done[/bash] I'd recommend creating an alias so that you can use it periodically. :]

Read More

How To REMOVE Crap In footer.php w. grep sed

penguin-beer

Lets get ride of garbage hard coded in premium themes. Only doing this because 1.) GPL and 2.) I paid for this theme, why is their copyright in it? 🙁 Do I have to buy you a beer too? More than willing too. :]

[bash]grep -lr –include=footer.php "<p id="copyright">" /home/USERNAME/public_html/wp-content/themes | xargs sed -i ‘s#<p id="copyright"><?php printf( __([^;]*; ?></p>##g'[/bash]

If this looks Greek to you, I’d recommend reading up on grep and sed documentation. There are great examples of how to use it with regex.

Read More

Inspiration: WordPress Multisite Running On Amazon Web Services

I honestly don’t know why, but I have always feared the day that I would dive head first into Amazon Web Services. In the last two weeks, I have been researching the in’s and out’s of AWS, how people are using it to deploy applications, security, it’s architecture and reading AWS terminology… It is very overwhelming, but I think it’s time I embarked on this adventure.

A few inspirations, Earmilk.com’s Blake Shoji. Although I have never met IRL, nor interacted with him online; the Earmilk network boggles my mind. They definitely sparked my curiosity! If your a music lover, I’d recommend checking them out!

While I was reading up on AWS, I happen to find David Jensen’s blog post on how to install WordPress on Amazon AWS EC2. I am going to use this documentation as a basis for my study, although I do want to branch off to NGINX. We’ll see where the path takes me!

If you need further inspiration that will help motivate you to jump into the cloud, I highly recommend watching “The Known Universe” with The XX Intro Extended dubbed over it. Seriously, the possibilities are endless!

Read More

Kernel.org Down – Installing Git On CentOS

This week I had a SSD tank and I was forced to install a fresh OS. While setting up my workstation, I decided to test VM VirtualBox > VMWare. While I was setting up my VM, I couldn’t grab wget http://kernel.org/pub/software/scm/git/<latest>.tar.gz

I wasn’t sure what was going on so I pinged kernel.org, no packets returned. I was completely unaware that kernel.org DNS’s got hacked. Linus released Linux 3.1 on Github and I needed to get git up fast.

Installing Git On CentOS 5.5

Quickly, I checked the  Webtatic repo for git. Add the repo with this line:

[code lang=”bash”]rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm[/code]

Next you can install git with one line:

[code lang=”bash”]yum install –enablerepo=webtatic git-all[/code]

Installing Gitolite For Private Repo

Below is the quick install guide for gitolite – for all you that want a private repo. I’m currently installing this on a VM just to test it out. Eventually I will move my repo into a datacenter. For now, I just want a private repo so I can seamlessly push / pull between my desktop and laptop while having redundant backups of my projects.

—————————————

If you’re comfortable with Unix and ssh, the following steps should work. (However, gitolite has lots and lots of useful features; don’t miss out on them by skipping the excellent documentation!)

  • create a user called git. Login to this user.
  • copy your ssh pubkey from your workstation. Rename it to YourName.pub.
  • now run these commands:

[code lang=”bash”]
git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
gl-setup ~/YourName.pub[/code]

You’re done. Now run git clone git@server:gitolite-admin on your workstation and add users and repos.

—————————————

Head over to https://github.com/sitaramc/gitolite if your looking for further documentation on gitolit. I’m assuming this will be the best for a private git repo. I will update this post with more information once I have my workstation / laptop setup. Come to think of it, I bet I could write a great post about developing between work,  home, and mobile.

Read More