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

How to Replace Galaxy Note 4 Screen – by Zedomax!

Over the past year or so I’ve become a fan of @Zedomax on Twitter. He caught my attention with his open frame bitcoin miner design. About a year and a half ago I got into mining Litecoin, Dogecoin, and using exchanges to play a bit of the Bitcoin game. I soon discovered how resourceful Zedomax’s channels and websites are, and wondered why I never seen these show up on Google SERPS. Let’s not get into SEO!

Max recommends getting the LCD screen with assembly, which makes replacing the LCD screen less complex and is only about $20 more. All you have to do is swap over the motherboard, camera, and back frame.

This video is a bit inspiring, it’s been a while since I’ve rooted, flashed, and help fix broken Android phones. Perhaps I’ll have to provide my services to local friends when I have downtime. :]

Read More

AT&T Galaxy S4 Prevent/Freeze OTA Updates

5588953445_51dcf922aa_o

Prevents NI4 to NJ4, the AT&T/Samsung OTA update keeps bugging me and I want to turn off the software update. If you are on a rooted AT&T Galaxy S4 and want to prevent the OTA update you can block the following apps with App Quarantine ROOT/FREEZE. Last time my OTA updated it went to NI4, broke Safestrap and Towelroot!

Block these in App Quarantine, tap the Settings icon and tap Filter, turn on Advanced and check Include system services. Block the following apps according to guut13 on XDA Forums.

  • AT&T Software update
  • wssyncmlnps
  • LocalFOTA

citation:
https://play.google.com/store/apps/details?id=com.ramdroid.appquarantine&hl=en
http://forum.xda-developers.com/showpost.php?p=56765224&postcount=36
http://netdungeon.com/stopping-att-android-software-updates/
photo curtious of etnyk on Flickr under Creative Commons!

Read More

TP-LINK TL-WN725N on BAMT 1.5

LitecoinMiner-5

I recently was asked to take a look at a Litecoin miner logs due to stability issues, I had no idea how deep this rabbit hole would go. After many struggles with Xubuntu and AMD drivers, I found BAMT. BAMT aka “Big Ass Miner Thing” is a fork of the original BAMT project that was aborted, picked up by Bee on litecointalk.org – I’ve since rebuilt a miner and built 2 personal litecoin mining rigs. If you are in Bellingham, Whatcom, Skagit, Snohomish, or Vancouver Lower Mainland and need technical assistance with Bitcoin / Litecoin miners, feel free to reach out. I do it for the Dogecoin!

Repository can be found here:
https://bitbucket.org/beebee/bamt/

Download BAMT from Bee’s maintained thread:
https://litecointalk.org/index.php?topic=2924.0

How To Get TP-LINK TL-WN725N on BAMT 1.5

I wanted to use a USB Wifi dongle on BAMT for my dogecoin mining rigs so that I can relocate them into my garage. I randomly ordered a cheap $9 Wifi USB dongle on Amazon and figured making the leap of faith would be fun. Here’s how I got it running on BAMT.

I referenced WikiDevi.com for the appropriate repository to clone. I had the v2 of this Nano USB.

https://wikidevi.com/wiki/TP-LINK_TL-WN725N_v2

The repository is in the sidebar, I laughed audibly when I figured out BAMT has git natively, thank you Bee or whoever put that there! If you’re version of BAMT doesn’t have git, in Root Terminal type: apt-get install git

If you’ve never compiled from source before, open up Root Terminal:

cd ~/
git clone https://github.com/lwfinger/rtl8188eu.git
cd rtl8188eu
make
sudo make install

These steps may vary, make sure you’re using the correct repository. If you’re not using a TP-LINK Google around or look around WikiDevi.com for your hardware.

I got frustrated when passphrase didn’t save. Posted to /r/bamt – after a bit I made an edit:

http://www.reddit.com/r/BAMT/comments/1zlvjm/wireless_usb_doesnt_save_network_passphrase/

johnislarry wrote:
So I managed to find a solution to my problem. I don't know if it will help anybody else, but maybe it will. I changed two things. The first was creating a file
/etc/polkit-1/localauthority/50-local.d/org.freedesktop.NetworkManager.pkla
and writing the following lines to it:

[nm-applet]
Identity=unix-group:network
Action=org.freedesktop.NetworkManager.*
ResultAny=yes
ResultInactive=no
ResultActive=yes

That can also be found here https://wiki.archlinux.org/index.php/Ne … ermissions and it allows users in the group "network" to use nm-applet functionalities. The second > thing I changed was commenting out a "no-auto-default" line in /etc/NetworkManager/NetworkManager.conf.
After these changes I am able to use nm-applet as a regular user for connecting to both secured and unsecured networks.

Also note: when saving the wifi passphrase check “Available for all users” before clicking Apply!

Got my TL-WN725N to work on Bee’s BAMT 1.5 and now I can relocate the box into the garage without running a 50 ft cat6 across the house. 🙂 hope this helps.

Read More

Varnish HTTP Accelerator Presentation Notes

varnish-cache-image

Poul-Henning Kamp discusses Varnish HTTP Cache at TYPO3 2010 in Frankfurt. In this post, I will provide detailed notes of his presentation. This is for learning purposes and may contain inconsistencies. I will do my best to keep it sharp.

Varnish HTTP Accelerator Presentation Slides

Notes From Varnish HTTP Cache @ TYPO3 w. Poul-Henning Kamp

Content creation can be automated, you have a master copy and you want to distributed it as much as possible. You really want it to be faster than the Linotype, and a step beyond the Heidelberg Print Machine. Varnish’s Elevator Pitch, “Varnish delivers content faster & reliably, reduces the load on your CMS database, cheap hardware does 100+ kreq/s, can assist in content composition, can fixx stupid mistakes, fast, is Free & Open Source Software, has commercial support.”

After 15 years contributing to the FreeBSD project, Poul-Henning Kamp was approached by VG.no to write a web server. VG.no utilizes a slow CMS which needed a caching system that speeds up the HTTP accelerators. With Varnish, Kamp was able to reduce the use of 12 Squid cache services to a mere 3 Varnish cache servers and greatly reducing the response times.

Poul-Henning Kamp’s goals for Varnish started out simple

  • Varnish is only a HTTP Accelerator.
  • Better configuration.
  • Much Faster
  • Content Management Focused Feature Set

“We don’t do FTP, we do HTTP and we do it damn well,” Kamps continues “This is not a cache to put on the client side, this is a cache to put on the server side. It’s important to understand one thing here, the controlling standard for HTTP is still RFC2616, and if you read it real carefully you will find one place where it mentions a cache on the server side,” “then they realize, actually a cache on the serverside is just another web server.”

Cache on the client size has constraints, you cannot cache per user, private cache, crypto, etc. Varnish as a web server can cache anything we want server side, including crypto!

Understanding Varnish and VCL

Varnish aims to make the configuration process simple in VCL or C language. It’s important to understand the operations of Varnish according to the diagram below.

varnish-state-machine

An example of receive VCL code below.

sub vcl_recv {
if(req.url ~ “\.\.|\.exe”) {
error(999, “Bugger off.”);
}
if(client.ip ~ editor_ip) {
set req.http.x-cms = “no stats”;
return(pass);
}
if(req.url ~ “\.(jpg|png|gif|css)$”) {
unset req.http.cookie;
unset req.http.authenticate;
set req.backend = static_backend;
}
if(req.url == “hotstory.hmtl”) {
set.url = “hotstory.html”);
}
}

Understanding Why Varnish Cache Language Is Epic

  • Compiled to binary/shlib via C-code
    • Runs full speed
  • You can have multiple VCL’s loaded at the same time
    • Switch between them without restart
    • Instantaneous
  • Allows you to do anything you might fancy
    • Inline-C code, ’nuff said.
    • Modules/shlib will make it easier (3.0 feature)

Wikia has broken the 4000+ lines of VCL code and is available online via SVN for all to study.

An example of how Wikia’s VCL code utilizing multiple varnish servers. In this example there are two Varnish servers, one in Germany and one in England. The client is located in Germany attempted to access a server in the US. The client hits the Germany varnish server first, but the German Varnish server tells the client to connect to England Varnish than to the US because England’s pipe to the United States is bigger. This speeds up the load times since Germany’s direct tube to the US is clogged. You can’t just dump stuff on it, it’s a truck.

sub vcl_recv {
if (client.ip == “varnish1”) {
set req.backend = usa;
} else {
set req.backend = england;
}
}

Managing Varnish

Varnish is a daemon process on your computer and utilizing Command Line Interface for real-time control. The Management/Working process split. The manager allows (re)start the worker proc. Allows privilege separation. It also contains multithreading to worker process.

varnish_architecture_shah_anand

Image Source: shah-anand.com (thx bro).

Looking over the Varnish architecture we have one binary program that contains two processes, the Managing Process and Cacher process. The managing process will take your VCL code, send it to the C-compiler, and off to shared object for the Cacher process loads. Varnish Cache also has a cluster control concept that can control 10 different instances of Varnish is separate geolocations. The cluster control is still a concept and is not built out.

One thing to note: Varnish does not write .lock files – it has a shared memory segment, it places lock information and statistics in there and other applications will pull from the shared memory.

Brief CLI Management

Example of CLI Management below (I am a bit lost on this because on param.show I get an error on my instance.

$ telnet localhost 80
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’
param.show
200 675
default_ttl 120 [seconds]
thread_pools 5 [pools]
thread_pool_max 1500 [threads]
thread_pool_min 1 [threads]
thread_pool_timeout 120 [seconds]
overflow_max 100 [%]
http_workspace 8192 [bytes]
sess_timeout 5 [seconds]
pipe_timeout 60 [seconds]
send_timeout 600 [seconds]
auto_restart on [bool]
[…]

Performance & Speed

Programmed for performance since day one. They wanted to make sure they were aiming for wire speed. Performance is not something you do after the fact, you do it from day one and don’t add things that will bog it down. Writing the code for Varnish aims for today’s complex hardware. This isn’t designed for your dad’s computer anymore!

Use modern features:

  • Virtual Memory
  • sendfile(2), accept_filters(2), kqueue(2)
  • and ever other trick in the book

Performance price list has changed, we can execute 100,000,000+/s per cpu. Disk I/O is behind on response time, stored memory is instead placed in virtual page memory (RAM). Classical logging is horribly expensive. (Examples in slides).

Where does my traffic come from?

Below are a few commands that you can use to access information on a live Varnish instance.

$ varnishtop -i Rxheader
$ varnishtop -i Rxurl
$ varnishhist

Varnishhist is real-time histogram that shows the cache-miss (#) / cache-hit (|) on an x & y axis.
$ varnishstat

Varnishstat pulls real-time statistics from shared memory

Content Management Features

  • Instant action purges/bans (regex or exact match)
  • TTL/Caching policy control in VCL
  • Load/Situation mitigation in VCL
  • Header washing
  • Vary
  • Edge-side-includes (ESI)

27:14

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

Unified Remote – Androids Answer To Wireless PC Remote!

One of the main reasons I need a wireless PC remote is Netflix and Hulu Plus… I do not own a Television, and if I have a “movie date night” it’s kind of odd to have my guest sit as I awkwardly fumble a keyboard and wireless mouse in the dark.

A few nights ago while I was laying their with my girlfriend, we were coming up to the end of an episode of Sekirai. I couldn’t find my wireless mouse and decided to Google around for a solution.

I ended up finding a god sent savior, Philip from Unified Remote to the rescue!

I quickly downloaded the app and installed the server side client to my PC all while Sekirai continued to play on Netflix. Without a hesitation, Kayla asked, “What are you doing babe?”

Why Is Unified Remote The Best?

I have tried many different types of remotes. Let’s break it down: Xbox 360 Wireless Controller + Wireless PC Dongle, Windows Media Center PC Remote Control, Logitech Wireless G700, TeamViewer for Android, and I’m NOT about to pay $40 for Logmein for Android! To put it simple: Unified Remote has a built in mouse touch pad, utilizes the Android keyboard for input, has specialized remotes for Netflix, Hulu Plus, Pandora, Windows Media Player, VLC, foobar2000, iTunes, and much much more.

TL:DR; Unified Remote has a mouse pad, keyboard, Netflix, Hulu Plus, VLC, iTunes remote.

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