Category Archives: Technology

Deploy Facebook Bot in Python

Let’s love every word (hmm) in the English language.

Here’s a small bash script to run your own Every Word Bot variant on Facebook. Instead of “fu*k+ word”, we’ll stick to “love+word.”

The script will install Python and necessary modules required to run the bot. You may bookmark this page as well. I will write more Facebook automation scripts in the near future.

Prerequisites

  1. Create a Facebook page
  2. Sign up with DigitalOcean or a cloud-provider of your choice, and set up a low-tier Ubuntu 20.04 instance.

You’ll get 100USD credit on DigitalOcean if you register with the link I shared.

Recommended Settings for DigitalOcean

Deploy Your Facebook Bot with Python

Proceed if you meet the requirements listed in prerequisites.

  1. Generate a non-expiring access token.

    maxbots.ddns.net/token is a tool designed to let you get an access token to allow a Facebook bot to autopost. You use this access token in your API requests for authentication purposes. The access token you receive never expires, unless your account or page gets zucced.

  2. Download fb-bot-starter v1.0 Bash script.

    fbs.sh is a Bash script I created to help you install Python, supporting modules, and set up the bot in action.

    Login to the server, and run wget https://chipfuzz.com/fbs.sh

  3. Make fbs.sh executable.

    In order to run a file directly, we’ll need to change the permissions to allow the script to be executable for the user. chmod is a command that changes permissions on a file, and +x will add execute rights to the script.

    Run chmod +x fbs.sh to make fbs.sh executable.

  4. Execute .fbs.sh.

    Type in ./fbs.sh and press enter.

  5. Enter the access token.

    Enter the access token when the script prompts you to do so.

Yep, that’s it. The script will create a tmux session named lewbot, which will run in the background and automate the page.

Why tmux?

tmux is a terminal multiplexer. The tool allows you to have multiple terminal commands and applications running visually next to each other without the need to open multiple terminal emulator windows.

nohup is another option, but I feel tmux is nice and sleek enough to run FB bots.

main.py script breakdown

Let’s have a look at the main script that powers the Facebook page.

The modules

import random
import facebook
import schedule
import time

random: to cut a line randomly from the words.txt and so on.

k = 1
filename = 'words.txt'
with open(filename) as file:
    lines = file.read().splitlines()

if len(lines) > k:
    random_lines = random.sample(lines, k)
    chosenline = "\n".join(random_lines)
    chosenlinestr = str(chosenline)
    message = "Love " + chosenlinestr 
    print(message)

    with open(filename, 'w') as output_file:
        output_file.writelines(line + "\n"
                               for line in lines if line not in random_lines)

facebook: to interact with the Facebook Graph API
schedule and time: No Shit, Sherlock.

Access Token

#FB Access Token = 'acesstoken'

Post to Facebook

#let's post it
def post():
    #Facebook stuff
    graph = facebook.GraphAPI(accesstoken)
    post_id = graph.put_object(parent_object='me', connection_name='feed', message = message)
    print(f"Submitted \"{message}\" on Facebook successfully!")
    

if __name__ == '__main__':
    schedule.every().hour.do(post).run()
    while 1:
        schedule.run_pending()
        time.sleep(1)

Tip Me

Support if you’d like by referring my resume or donating through PayPal.

Combine Multiple Videos Using ffmpeg

As seen on ma.ttias.be. I’m just documenting this in my own way for future reference. This method is only applicable to videos of the same dimensions and encoding. Tested on FFmpeg 4.3. I use this method to download and concatenate youtube-dl outputs.

Step 1: Create a text file and make a list of video files.

touch files.txt
vi files.txt

Example content to save:

file 'p1.mp4'
file 'p2.mp4'
file 'p3.mp4'
file 'p4.mp4'

Step 2: Run the command below

ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4

New Laptop & Linux Mint

Update: Sold the HP laptop and purchased an Acer Swift 3 Intel variant. Running macOS and Windows 10 at the moment.

My Lenovo ThinkPad X230 is no more. Lost it to a motherboard issue caused by electrical surge. I’ve been using that laptop connected to direct AC.

Got hold of an HP 14q-cs0029tu i3 8th gen variant. The laptop comes with i3 8130u CPU, Samsung 8GB DDR4 2666MHZ Memory & 256GB WD SN750 NVMe™ SSD. They shipped the laptop with Windows 10 Home.

But, meh…I don’t have a good internet connection at home, which means I can’t install Steam and play lightweight indie games. So ultimately, except for FL Studio, Windows 10 is useless to me at this point.

Installed Linux Mint 19.1 Xfce right away. I’ve installed LMMS as the backup DAW for the time being. I really don’t feel like going to back Windows just for FL Studio. I haven’t installed GIMP yet.

HP 14q-cs0029tu Linux WiFi Driver

And if you’re planning to install Linux on this HP laptop, keep in mind that WiFi won’t work OOB. You’ve to install the Realtek RTL8723DE module for Linux and restart the Machine.

Footnotes

  • I took that cover photo while unboxing. Sorry about the distortion.
  • I use Mc-OS CTLina XFCE theme & OS Catalina icon pack.

API-alpha for Bug Guide

Status: Deprecated

Explore the data-set of 35447 insects!

Based on bugguide.net’s multiple .txt sets, I created an API to deliver insects’ data in JSON format. At present, the API only delivers the common name, genus, species, family, order, bug_guide_id, and bugguide.net URL information.

API Endpoint

https://bugs.deadauthor.org?api&

Documentation

Data can be parsed as JSON. Access to the bugs.deadauthor.org doesn’t require a token-based authentication. Kindly avoid sending too many requests. Consider donating if you plan to actively use the API.

Examples

Query a common name

GET https://bugs.deadauthor.org?api&common_name=Brown%20Angle%20Shades

Query a genus

GET https://bugs.deadauthor.org?api&genus=Oligotoma

Query species

GET https://bugs.deadauthor.org?api&species=nigra

Query a family

GET https://bugs.deadauthor.org?api&family=Oedemeridae

Query an order

GET https://bugs.deadauthor.org/?api&order=Coleoptera

Query a bug_guide_id

GET https://bugs.deadauthor.org?api&bug_guide_id=389

Query combination example

GET https://bugs.deadauthor.org?api&species=scrutator&order=Coleoptera

API Usage Example (Python)

https://github.com/migftw/bugguide-api/blob/master/parse-json.py

Alpha disclaimer

The bugs.deadauthor.org API is actually in the alpha stage, which implies that “bugs” and issues may still remain undiscovered until this phase of testing is complete.

The alpha stage also means that the data may be corrupted, is not 100% validated or complete, and is subject to change.

Finally, services may have downtime and the API schemas and calls are subject to change

An Example Bot for Twitter & Facebook

Here’s a small Python script to run your own Every Word Bot variant on Facebook and Twitter. The basic guide is available at the bottom of the article. Unfortunately, the guide is not applicable to beginners. Here’s the GitHub repo.

Step 1 — You need a VPS or an account on pythonanywhere.com to host and run this script. I highly recommend a DigitalOcean droplet if you can afford a VPS. I think you’ll get a 50USD or 100USD credit on DigitalOcean when you sign-up with the link I shared. You could check Amazon AWS or Google Cloud Platform also. Select Debian, Ubuntu, or CentOS while you’re creating a droplet or instance.

Step 2 — Install Python 3 followed by the modules facebook, tweepy, and schedule. Installing modules will become fairly easy once you get the hang of it. 

Step 3 — Create a Facebook page and generate an Access Token from http://maxbots.ddns.net/token/. Paste the token to the accesstoken field in the script.

Step 4 — Create a Twitter app and generate tokens & secret keys. It’s explained in the Access token/secret method section of this blog post

Step 5 — Download the English words data-set of your choice.  Replace the words.txt in my repo with the text set of yours. Fire up the script with the command sudo python3 main.py

You can use tmux to manage the sessions.

Also read: https://github.com/aparrish/everywordbot

Get Creative

Look at @loveeveryword and @bottubebot for example. You could use Pillow to post images or even GTTS + moviepy to post videos.

Credit: Cover Photo by Brett Jordan on Unsplash

Python for Automation

30 days of Python, and it’s changing my perspective.

I’m more of a “front-end” development guy. I routinely manage WordPress websites and optimize the servers for optimal performance. Python or Node isn’t something I need every day.

Here’s a source code to get started.

The Every Tom and Jerry Frame in Order Facebook page sparked my interest in the area of “social media automation for entertainment”. I grabbed that project’s source code and started tweaking.

Failed miserably at first. Then I wrote an email to the code maintainer. They were generous and wrote back. The emails went back and forth until I fixed my version of the script.

Learning and tweaking Python code has been a spiritually refreshing experience. I had a good time writing various other scripts.

The progress

I religiously use modules like OpenCV, moviepy, Wikipedia, Pillow, FFmpeg, schedule, requests, JSON, etc.

I’ve managed to learn more about JSON data as well.

I’ve also started using WordPress REST API with Python3.

Results (Facebook bots)

Deep Dreaming Harvard Art Museums Bot — A Facebook page that lets you explore Harvard Art Museums in DeepDream (neural network) mode. Objects are picked in no order. No logs stored on my server.

Met. Museum Bot — Another art museum based on The Metropolitan Museum of Art’s API. 474383 objects in total.

Fishbot 13229 — An ultimate wiki-bot that shares photos and information about fishes. I use fishbase.se’ data as the base to gather Wikipedia info and images.

Birdbot 11147 — Another wiki-bot destined to share photos and information about birds. It also shares the IUCN Red List status.

Insect Bot 35499 — A bot that appreciates hexapod invertebrates.

CryptidWiki Bot — A bot based on cryptidz.fandom.com’ data. It shares stories about various cryptids in a timely manner.

Amphibians & Reptiles Bot — Another wiki-bot that shares photos and information about amphibians and reptiles.

Plant Bot — A bot that randomly posts an image of your favorite photosynthetic eukaryotes. The image search isn’t perfect yet.

Bots With Attitude — A bot based on GPT-2 captions and AI-generated (API) photos. Still a work-in-progress.

abstraktr.py — A script that generates CC0 1.0 abstract art every hour. Based on an open-source project.

Haunted Places Bot – US Edition — A bot that shares info about haunted places in the US. The script uses data from Shadowlands Haunted Places Index. Images are randomly captured from search engine results.

@1000000Bot — A script that randomly shares a website URL (from Alexa’s dataset) and its basic PageSpeed insights.

Miscellaneous

  • https://www.facebook.com/loveeveryword/
  • https://www.facebook.com/bottubebot
  • https://www.facebook.com/waybackexe/ (Scrape)
  • https://www.facebook.com/anguirusbot
  • https://www.facebook.com/cidmoosabot

Gigabyte B150M-VP Skylake Hackintosh Guide

This was an easy one. I’ve recently installed macOS Catalina 10.15.2 on my desktop PC. The specs are Gigabyte GA-B150M-VP, i5-6600K CPU, Team Elite 8GB DDR4 2400Mhz Memory, and Radeon™ RX 580 GPU alongside a boot SSD for macOS and shared HDD storage for macOS and Windows. This is a test set-up and I won’t tweak this build for the latest versions of Clover or macOS.

Skylake Hackintosh Menu Bar

A word of warning; you should modify the EFI (a lot) if your system specs are different. Ethernet isn’t working for me for the time being. Downgrading Clover would fix that. But I use a nano-USB adapter for WiFi. I’m content with that. Everything else should work out of the box if you have the specs as mine.

Nota bene

  • Proceed with caution. Don’t blame me if you didn’t back up.
  • Delete VoodooHDA from Kexts/Other, if the AppleALC Kext is working.
  • The guide is not applicable to Opencore bootloader. Go ahead though, if you know what you’re doing.

Download The EFI Pack

My EFI folder is applicable for Vanilla approach and SSD hot-swap (just replace/paste EFI folder – not recommended though.) If things go south, use the clover settings from Hackintosher’s ASUS Z170 EFI Pack. But then you’ve to tweak settings a bit more.

Kexts for Gigabyte B150M Skylake Hackintosh Catalina

Kexts/Other folder.

What Doesn’t Work?

  • Sleep/wake
  • Ethernet (For the time being. Catalina broke the ethernet for me. I use a WiFi adapter anyway. So no plans to fix it real soon.)
  • FaceTime/iMessage (It will work after SMBIOS edits. You should do that.)

Resources

  • Guide to create a bootable macOS Catalina USB install drive (on macOS)
  • Guide to create a bootable macOS Catalina USB install drive (on Windows)

Post USB preparation

  • Install Clover to the USB flash drive.
  • Use Clover Configurator (macOS) or DiskGenius (Windows) to mount the EFI folder within the USB flash drive.
  • Paste my /EFI folder to the EFI partition.

Good luck!

Tip Me:

Support if you’d like by referring my resume or donating through PayPal, Phonepe, or Alipay.

Update: ThinkPad T530 Hackintosh Catalina

ThinkPad T530 is undoubtedly a solid machine that can handle macOS Catalina. I installed Mojave on this machine a while ago but never bothered to use T530 as a daily driver. Skip introduction at your own risk.

But here we are! The hacking part was quite easy this time. Few Kext updates and alongside Clover update did the job. I haven’t edited the config.plist from Mojave installation as well. Luckily Apple didn’t throw any kernel panic while testing. I did a Vanilla install by the way.

Behold, behold The mighty one!

Alright, let’s dive in! Read the guide carefully if you’re a beginner. Don’t blame me if you f*ck up your current OS.

Don’t forget to fork or star my GitHub repo while you’re at it. Please don’t sell the EFI or use it on your YouTube video without giving credit to the original author. Don’t be an A-hole.

My ThinkPad T530′ Specs: i7 3740QM, 16GB Memory, 128GB SSD + 256GB SSD + 750GB HDD, NVIDIA NVS 5400M (N/A for Hackintosh)

Search Results Web results Hackintosh | Installing Catalina on Lenovo T530

The Kexts/Other folder.

What Doesn’t Work?

  1. Inbuilt WiFi card.
  2. Mini DisplayPort.
  3. Fingerprint reader (if you’ve one).
  4. Card reader.

#README

  • Proceed with caution.
  • Tested on macOS Catalina 10.15.2.
  • EFI folder is N/A for Opencore bootloader. Go ahead though, if you know what you’re doing.
  • Do a Vanilla install if possible. I haven’t tested a direct update from Mojave.
  • The EFI folder is applicable to SSD hot-swap also. ie, if you’re planning to swap SSD from a MacBook Pro to ThinkPad 530.

Download The EFI folder for ThinkPad T530

Recommended BIOS settings

Disable dGPU: The process is quite simple. Go to BIOS Setup -> Config -> Display and set the Graphics Device as “Integrated Graphics.” Also, disable the OS Detection for NVIDIA Optimus. Make sure it looks like the attached image below. Then, select Save & Exit.

ThinkPad T530 BIOS Display Settings for Hackintosh

Select UEFI Only: Go to BIOS Settings → Startup, select UEFI only.

Disable CSM Support: Do this if the USB doesn’t boot initially. Go to BIOS Settings → Startup, disable CSM support.

T530 BIOS Startup Settings for Hackintosh

ThinkPad T530 macOS Catalina – Vanilla Installation Guide(s)

It doesn’t matter if you own a real Mac or not. I’ll share the installation guide for both macOS and Windows.

How to create a bootable macOS Catalina 10.15 USB install drive? (on macOS)

Step 1: Refer to this guide from 9to5mac

Step 2: Download and install Clover to USB.  Refer to this article for clarity.

Step 3: Install Clover Configurator, and mount the EFI partition. Then replace the EFI folder with the one on my repo.

How to create a bootable macOS Catalina 10.15 USB install drive? (on Windows)

Step 1: Install Transmac on a Windows machine. It has a 15-day trial period and works flawlessly flashing DMG files to USB.

Step 2: Download the macOS 10.15.2 with clover dmg file from here or other sources you come across Google SERP.

Step 3: Download the EFI folder in my GitHub repo.

Step 4: Download Clover Configurator for macOS (latest version).

Step 5: Connect a 16 GB USB flash drive.

Step 6: Open Transmac. In the left pane, right-click the USB Drive and select Format Disk for Mac

Again in the left pane, right-click the USB Drive and select Restore with Disk Image. Then select the DMG file I mentioned in (2). The flashing process will take a few minutes depending on the size of .dmg and speed/port of the USB drive.

Step 7: Install DiskGenius.

Step 8: Locate the USB drive in DiskGenius. Delete the EFI folder and replace it with the new EFI folder. Refer to this part of a YouTube video for clarity.

Step 9: Plug the USB drive into the ThinkPad T530 and boot from USB.

Step 10: Format the disk drive to APFS, install macOS Mojave and restart the system.

Step 11: Connect the Hackintosh system to the Internet via LAN cable, USB tethering or a Mac-compatible external WiFi adapter.

Step 12: Download & install Clover Configurator on MacOS. Open EFI partition and copy -> paste the EFI folder once more.

(Optional) You may use Karabiner-Elements if the keyboard mappings (command and option) are acting up.

All the best! Write to me if you need professional guidance.

Success: ThinkPad T530 Hackintosh Setup

I know you badly need the ThinkPad T530 EFI folder or Clover configuration file ASAP. Can we start with a backstory though?

Update: I’ve published a new guide to install macOS Catalina on ThinkPad T530.

Back at my ThinkPad T530. I love this beast of a machine. It’s easily capable of handling eGPU (GTX 9604G & 750Ti), and MacOS for work. The device performs similar to a mid-2015 MacBook Pro. Also, note that I don’t prefer Catalina at the moment, so my EFI folder is only applicable to the latest build of Mojave.

So here we go. Don’t forget to fork or star my GitHub repo, it’s your call.

My ThinkPad T530′ Specs: i7 3740QM, 16GB Memory, 256GB SSD + 256GB SSD + 1TB HDD, NVIDIA NVS 5400M (N/A for Hackintosh)

Mighil.com's T530
ThinkPad T530 Boot Screen ~ Clover Bootloader

The Launchpad

ThinkPad T530 Hackintosh Mojave Launchpad
Yeah, iMessage aka Message is working.

The Display Resolution Settings

ThinkPad T530 Hackintosh Display Settings
ThinkPad T530 Hackintosh Display Settings

What Doesn’t Work?

  1. Inbuilt WiFi card.
  2. MiniDP
  3. Fingerprint reader
  4. Card reader.

#README

  • Proceed with caution.
  • EFI folder is N/A for Opencore bootloader. Go ahead though, if you know what you’re doing.
  • EFI-swap recommended. I haven’t tested these settings against the latest version of Clover.
  • The EFI folder is applicable for Vanilla approach and SSD hot-swap (just replace/paste EFI folder – not recommended though.)

Dude, what’s an SSD hot-swap?

It’s a half-arsed practice. This involves installing macOS Mojave on a real MacBook Pro and moving its SSD to the T530 after editing the EFI folder. It’s wise to choose a machine similar to ThinkPad T530 in terms of CPU and screen resolution, eg: mid-2012 MacBook Pro.

Download The EFI folder for ThinkPad T530

Use the BIOS settings as mentioned below.

Disable dGPU: The process is quite simple. Go to BIOS Setup -> Config -> Display and set the Graphics Device as “Integrated Graphics.” Also, disable the OS Detection for NVIDIA Optimus. Make sure it looks like the attached image below. Then, select Save & Exit.

ThinkPad T530 BIOS Display Settings for Hackintosh

Select UEFI Only: Go to BIOS Settings → Startup, select UEFI only.

Disable CSM Support: Do this if the USB doesn’t boot initially. Go to BIOS Settings → Startup, disable CSM support.

T530 BIOS Startup Settings for Hackintosh

ThinkPad T530 macOS Mojave – Vanilla Installation Guide(s)

It doesn’t matter if you own a real Mac or not. I’ll share the installation guide for both macOS and Windows.

How to create a bootable macOS Catalina 10.15 USB install drive? (on macOS)

Step 1: Refer to this guide from 9to5mac

Step 2: Download and install Clover to USB.  Refer to this article for clarity.

Step 3: Install Clover Configurator, and mount the EFI partition. Then replace the EFI folder with the one on my repo.

How to create a bootable macOS Catalina 10.15 USB install drive? (on Windows)

Step 1: Install Transmac on a Windows machine. It has a 15-day trial period and works flawlessly flashing DMG files to USB.

Step 2: Download the macOS 10.14.X with clover dmg file from here or other sources you come across Google SERP.

Step 3: Download the EFI folder in my GitHub repo.

Step 4: Download Clover Configurator for macOS (latest version).

Step 5: Connect a 16 GB USB flash drive.

Step 6: Open Transmac. In the left pane, right-click the USB Drive and select Format Disk for Mac

Again in the left pane, right-click the USB Drive and select Restore with Disk Image. Then select the DMG file I mentioned in (2). The flashing process will take a few minutes depending on the size of .dmg and speed/port of the USB drive.

Step 7: Install DiskGenius.

Step 8: Locate the USB drive in DiskGenius. Delete the EFI folder and replace it with the new EFI folder. Refer to this part of a YouTube video for clarity.

Step 9: Plug the USB drive into the ThinkPad T530 and boot from USB.

Step 10: Format the disk drive to APFS, install macOS Mojave and restart the system.

Step 11: Connect the Hackintosh system to the Internet via LAN cable, USB tethering or a Mac-compatible external WiFi adapter.

Step 12: Download & install Clover Configurator on MacOS. Open EFI partition and copy -> paste the EFI folder once more.

You may use Karabiner-Elements if the keyboard mappings (command and option) are acting up.

ThinkPad T530 Hackintosh Settings for Karabiner Elements
ThinkPad T530 Hackintosh Settings for Karabiner Elements

All the best!

Success: ThinkPad X230 Hackintosh Setup

I know you’re here for the EFI folder or Clover configuration file. Hang on, let’s start with the backstory, shall we? (Or skip the lame intro)

Note: I don’t have access to my X230 anymore. Please don’t expect updates.

To put you into perspective; I own a ThinkPad X230 Tablet. But I hate the bulky 6-cell battery it came with. So I purchased an X230 i7 model without memory and SSD. Then I upgraded the device to a 2 x 8GB 1600 Mhz memory + 256 GB mSATA + 256 GB 2.5″ SSD beast of a machine.

The Catalina Journey

Even though I prefer Mojave 10.14.16 as the daily driver, I got hooked by Apple’s update notification. So I made a CCC clone right away and decided to test Catalina on this machine. The direct update resulted in failure.

Then I searched for “ThinkPad X230 Hackintosh EFI” on Google. Luckily I stumbled upon @littlegtplr’s repo on Github. Their EFI settings worked for my vanilla installation. Then I made some changes to the settings and decided to post my result on Reddit and GitHub.

Latest Updates

  1. I no longer use @littlegtplr’s settings. I’ve configured everything myself and updated the repo.
  2. Applicable to Catalina 10.15 ~ 10.15.2.

X230 from 2012 Living The Catalina Dream! from hackintosh

 

Without further ado, you can grab the EFI Folder (Clover), plist, and BOOT required to install/run Thinkpad X230 Hackintosh Catalina 10.15. Move these files to your EFI Folder. I’ve got another EFI folder labeled EFI-test. Feel free to tinker that also.

Download The EFI folder for ThinkPad X230

WiFi

Inbuilt intel-WiFi adapter won’t work out of the box. Atheros AR5B95, Lenovo part number 20002357 is a macOS supported/Lenovo-whitelisted card available for X230. You should add IO80211Family.kext to Kexts/Other after installing the card.

Alternatively, you can flash the BIOS and remove the whitelist if you plan to use Broadcom WLAN cards. Stick with a nano-USB WiFi adapter (something cheap based on Realtek) if you don’t want to alter your hardware.

What Else Doesn’t Work?

Fingerprint reader & card-reader.

Nota Bene:

  • Proceed with caution.
  • Kindly delete the RtWlanU & RtWlanU1827 kexts from kexts/Other folder.*
  • These files are N/A for Opencore bootloader. Go ahead though, if you know what you’re doing.
  • EFI-swap recommended. I haven’t tested these settings against the latest version of Clover.

*I added Realtek WLAN kexts to use with my Comfast USB Wi-Fi adapter. You should edit the configuration according to your preferences. The EFI folder is 100% applicable for the Vanilla approach and SSD hot-swap.

Dude, what’s an SSD hot-swap?

Half-arsed practice. This involves installing macOS Catalina on a real MacBook Pro and moving its SSD to an X230 after editing the EFI folder. It’s recommended to choose a machine similar to ThinkPad X230 in terms of CPU & hardware configuration, eg: mid-2012 MacBook Pro.

ThinkPad X230 macOS Catalina – Vanilla Installation Guide(s)

It doesn’t matter if you own a real Mac or not. I’ll share the installation guide for both macOS and Windows.

How to create a bootable macOS Catalina 10.15 USB install drive? (on macOS)

  1. Refer to this guide from 9to5mac
  2. Download and install Clover to USB.  Refer to this article for clarity.
  3. Install Clover Configurator, and mount the EFI partition. Then replace the EFI folder with the one on my repo.

How to create a bootable macOS Catalina 10.15 USB install drive? (on Windows)

  1. Install Transmac on a Windows machine. It has a 15-day trial period and works flawlessly flashing DMG files to USB.
  2. Download the macOS 10.15 with clover dmg file from here or other sources you come across Google SERP.
  3. Download the EFI folder from this GitHub repo.
  4. Download Clover Configurator for macOS (latest version).
  5. Connect a 16 GB USB flash drive.
  6. Open Transmac. In the left pane, right-click the USB Drive and select Format Disk for Mac
  7. Again in the left pane, right-click the USB Drive and select Restore with Disk Image. Then select the DMG file I mentioned in (2). The flashing process will take a few minutes depending on the size of .dmg and speed/port of the USB drive.
  8. Install DiskGenius.
  9. Locate the USB drive in DiskGenius. Delete the EFI folder and replace it with the new EFI folder.
  10. Plug the USB drive into the X230 and boot from USB.
  11. Format the disk drive to APFS, install macOS Catalina, and restart the system.
  12. Connect the Hackintosh system to the Internet via LAN cable, USB tethering or a Mac-compatible external WiFi adapter.
  13. Download & install Clover Configurator on MacOS. Open EFI partition and copy -> paste the EFI folder once more.
  14. You may use Karabiner-Elements if the keyboard mappings (command and option) are acting up.

FAQ.

Tip Me:

Support if you’d like by referring my resume or donating through PayPal, Phonepe, or Alipay.

Success: ThinkPad X230t Hackintosh Setup

It’s about time to bid farewell to my mid-2012 MacBook Pro. The device has aged and I don’t want to change the battery. It works flawlessly nonetheless. What’s new? A Thinkpad X230 Tablet! Skip introduction.

Looking to install Catalina? You could take a look at this Hackintosh guide for ThinkPad X230. The guide is applicable to X230 Tablet variants also.

I’m already happy with my Xeon PC and T530 workstation but needed something lightweight, and powerful while I’m on the go. Hence the refurbished X230t I found on Taobao. I purchased a system with no memory and HDD.

Credits go to Jack Zhang for providing the EFI files.

X230t Specs

  • i7-3520m (Similar to a 13″ mid-2012 MacBook Pro)
  • 16GB RAM
  • Samsung PM810 Series 256 GB SSD
  • KingSpec 128GB mSATA SSD

X230t Hackintosh Digitizer Pen Support

My X230T is a 12.5 Multitouch HD model that came with the fingerprint reader.

What Doesn’t Work?

  • WiFi, you can hack BIOS and install a Mac-compatible WiFi card
  • FaceTime & iMessage
  • Card reader
  • Fingerprint reader

Before You Install Mojave 10.14.3

Kindly note that WiFi won’t work after installing Mojave. Ethernet LAN will work.

So, be prepared if you just own one machine for the whole process. I highly recommend you to get hold of another device for preparing USB, and downloading MacOS DMG, EFI folder, Clover configurator files.

Before You Do Anything

1. Go to BIOS settings → Restart → Load Setup Defaults

ThinkPad X230t Bios Reset
2. Go to BIOS Settings → Startup, select UEFI only disable CSM support.

ThinkPad X230t Disable CSM Support

Hackintosh Guide for ThinkPad X230t Tablet

1. Install Transmac on a Windows machine. It has a 15-day trial period and works flawlessly flashing DMG files to USB.

2. Download the macOS Mojave 10.14.3(18D42) Installer with Clover 4859.dmg.

3. Download the EFI folder.

4. Download Clover Configurator for macOS (latest version).

5. Connect a 16GB USB flash drive.

6. Open Transmac. In the left pane, right-click the USB Drive and select Format Disk for Mac

7. Again in the left pane, right-click the USB Drive and select Restore with Disk Image. Then select the DMG file I mentioned in (2). The flashing process will take a few minutes depending on the size of .dmg and speed/port of the USB drive.

8. Install DiskGenius.

9. Locate the USB drive in DiskGenius. Delete the EFI folder and replace it with the new EFI folder. Refer to this video.

10. Plug the USB drive into the X230t and boot from USB.

11. Install the macOS Mojave, and restart the system.

12. Connect the Hackintosh system to the Internet via LAN cable or a Mac-compatible external WiFi adapter.

13. Download Clover Configurator and refer to 6:32 of this video.

14. You may use Karabiner-Elements if the keyboard mappings (command and option) are acting up.

Tip Me:

Support if you’d like by referring my resume or donating through PayPal, Phonepe, or Alipay.

Success: ThinkPad T530 eGPU Initial Set-up

Here is the most straightforward plug-n-play guide to connecting an eGPU with Lenovo ThinkPad T530.

My laptop is powered by an i7 3720QM CPU, supported by 8GB x 2 memory. Furthermore, I’ve installed 256GB x 2 SSDs.

The system runs Windows 7 SP1, and I’ve used a GeForce GTX 750 Ti and GTX 960 4G for testing. I’ll share GPU benchmark scores later.

I’ve used the express card version of EXP GDC BEAST V8.5 adapter to connect the Graphics Card. You can purchase this adapter from Aliexpress or banggood.com if you’re outside of China. Since I’m in mainland China, I’m willing to help you buy, test and ship the adapter (for a small fee.)

Sites like banggood.com sell these for a high price. I’m willing to test (only the ExpressCard versions) and resell them for the same price.

My eGPU set-up:

  1. Thinkpad 530
  2. A Functioning ExpressCard slot.
  3. A second-hand GeForce GTX 750 Ti GPU.
  4. GeForce GTX 960 GPU 4G (Another GPU for testing.)
  5. A 500W PSU.
  6. EXP GDC BEAST V8.5 with ExpressCard connector & an ATX cable that came with the package.

Step 1: Disable dGPU. The process is quite simple. Go to BIOS Setup -> Config -> Display and set the Graphics Device as “Integrated Graphics.” Also, disable the OS Detection for NVIDIA Optimus. Make sure it looks like the attached image below. Then, select Save & Exit.

Step 2: Use DDU to Uninstall NVIDIA NVS 5400M Drivers. Display Driver Uninstaller (DDU) is a driver removal utility that can help you completely uninstall AMD/NVIDIA graphics card drivers and packages from your system, without leaving leftovers behind (including registry keys, folders, and files, driver store).  Doing so is to make sure your PC is clean for an external GPU. Download DDU from here. The software will prompt a restart after the uninstall process.

Step 3: Shutdown PC, Install GPU to EXP GDC’s PCI Express x16 slot and Connect  ExpressCard to the Laptop. Then connect power cables as shown below.

How to connect PSU, EXP GDC
Credits: banggood.com. Reference image.

If your GPU requires additional power, you can use the 6pin output to dual 6+2/8 pin connector to connect to your GPU’s power input.

Now connect the EXP GDC Expresscard Type 34/54 Interface (HDMI to Expresscard Cable), and connect the ExpressCard to the corresponding slot on the left side of the laptop.

If you’ve done everything well enough, it may look like this.

Step 4: Turn On PSU, PC, and wait for Windows to detect the eGPU. The external video card will be identified as a VGA Adapter within the device manager.

Step 5: Install the latest driver software for the eGPU. Visit Nvidia’s official website to download the latest driver software(s). Alternatively, you can drivers via the device manager in Windows. Install the drivers and restart your PC.

Step 6: Connect an external monitor 5 minutes after the first booting.  Right-click on your desktop>screen resolution. Set the external display as your primary monitor/display.

Follow step 6 only if your ThinkPad T530 doesn’t boot with an external display connected to the GPU. Leave it on otherwise.

You may Run>dxdiag or use the device manager to check the details of the GPU connected. Alternatively, you can use CPU-Z to confirm the specs.

Buy Quality-tested EXP GDC Adapters

Contact today if you want me to test an EXP GDC unit (I’m in China) and send it to your hometown. I also take bulk orders if you’re interested.

Cover: EXP GDC BEAST V8.5, HDMI to ExpressCard Cable and a GTX 750 Ti.

Review: Colorful SSD SL500 1TB

Heads-up, this is not a positive review. We purchased Colorful SL500 1TB last week from Taobao. The product shipped very fast, and I was so happy to extend the storage of my MacBook Pro. The build quality seemed good also, in the Taobao videos.

I regret wasting time on this SSD instead of purchasing a WD Blue. Read this review before purchasing a Colorful SSD or other Colorful storage devices in general.

Note: Tested on a MacBook Pro (13-inch, Mid 2012) and an Intel Xeon based Windows PC. I’ve tried both the USB 3.0 to SATA portable adapter and internal SSD installation methods. The SSD started acting up after the first format.

So, what happened?

The packaging was cheap. But it’s fine for the price they’re selling. Build quality and design aesthetics are appealing indeed.

Colorful SSD SL500 1TB Review

Everything looked fine at first. I removed the old Samsung EVO SSD from MacBook and installed this one. I had the backup online, so I tried installing macOS from internet recovery. Disk initialization went well, and I partitioned the SSD into 256GBx4 volumes.

Colorful SSD Mac Review

Things went downhill after the first reboot. It took a long time for the device to boot, which seemed odd. Then I tried to install macOS from internet recovery. The process got stuck, and macOS threw a weird error that I’ve never seen in my life. I couldn’t understand, and it’s a shame I didn’t take a photo of it.

Then I installed the old Samsung EVO SSD that contained OS files to the DVD bay (via adapter) and booted MacBook. The Disk Utility didn’t bother to show up this time. But it worked fine when I removed the Colorful SSD from the main SSD bay.

By this time, I was aware something is wrong with this Colorful SSD. So, I tried to fix the disk via recovery mode. Once again, Disk Utility wasn’t loading when SSD remained in the disk bay.

Next up, Windows.

I took the SSD and connected it to a Windows machine. Again, Windows took a long time to boot while having SSD connected to the motherboard via SATA connector. I tried Initialize Disk, but it failed to initialize by generating a disk error. I also tried other methods via command prompt (CMD) to clean and format the disk. Everything failed.

Colorful SSD 1TB Windows Review

When I tried to initialize the disk.

Colorful SSD SL500 1TB

Here’s one for the Colorful QA team.

Then I placed the SDD inside a USB 3.0 to SATA adapter and tried connecting it both on Windows and macOS. No luck at all. Finally, I gave up and shipped back SSD to the seller.

I’m so glad that Marui is a VIP member on Taobao. We can ship back any product on the basis of a “no questions asked” guarantee.

VERDICT

Think twice before purchasing any cheap solid state drives you come across. Save up and go for brands like WD or Samsung if you can. Their QA/QC procedure is top-notch. It’s fine for me because we’re in China. We can ship back similar products very soon. It’s not the same for other users buying stuff from Aliexpress or Chinese e-commerce sites.

The review is final. Contact me by email [email protected] if you represent https://www.colorful.cn/. I’ll provide you with a detailed feedback report.

Fix: enter-url-1.xyz Analytics Spam

This blog post is a master guide to block Google Analytics referrer spam. I’ve added various methods to block the referral spam and I’ll update the content accordingly.

You’re here because of the new referral traffic from enter-url-1.xyz, goodname1.xyz, 500-good-starts.xyz, 2-easy.xyz, secret-promotion.com, get-here-web.com, yesgood-now.com, yes-do-now.com, advert-seo.com, advertising-seo.com, ads-seoservices.com, seo-services-ads.com, ads-services-seo.com, ads-seo-manager.com, ai-seo-service.com, fast-seo-links.com, autoseotips.com, wakeupseoconsultant.com, 1-best-seo.com, 9-reasons-for-seo.com, 16-reasons-for-seo.com, local-seo-for-multiple-locations.com, seo-b2b.com, affordable-link-building.com, free-seo-consultation.com, get-seo-help.com, your-seo-promotion.com or its variants are spamming your Google Analytics data. Here’s how to block that single referral domain and related multiple referrers.

Method 1: block referral spam using Google Analytics
Method 2: disable spam in .htaccess (for Apache servers)
Method 3: disable spam in NGINX
Method 4: disable spam using Cloudflare

UPDATES:
10/05/2019: Added enter-url-1.xyz fix.
06/05/2019: Added check-pro1.xyz fix.
24/04/2019: Added goodname1.xyz fix.
18/04/2019: Added 500-good-starts.xyz fix.
04/04/2019: Added 2-easy.xyz fix.
03/30/2019: Added secret-promotion.com fix.
03/19/2019: Added get-here-web.com fix.
03/12/2019: Added yesgood-now.com fix.
03/11/2019: Added yes-do-now.com fix.
03/07/2019: Added one-a-plus.xyz fix.
02/26/2019: Added advert-seo.com fix.
02/25/2019: Added advertising-seo.com fix.
02/19/2019: Added big-seo-deal.com fix.
02/18/2019: Added ads-seoservices.com fix.
02/15/2019: Added seo-services-ads.com fix.
02/13/2019: Added ads-services-seo.com fix.
02/11/2019: Added ads-seo-manager.com fix.
02/08/2019: Added ai-seo-service.com fix.
01/31/2019: Added fast-seo-links.com fix.
01/23/2019: Added autoseotips.com fix.
01/18/2019: Added wakeupseoconsultant.com fix.
01/15/2019: Added bestecommerceseo.com fix.
12/19/1018: Added 1-best-seo.com fix and NGINX method to block the Analytics spam.
12/06/2018: Added 16-reasons-for-seo.com fix.
12/05/2018: Added 15-reasons-for-seo.com fix.
12/04/2018: Added  99-reasons-for-seo.com fix.
12/03/2018: Added  100-reasons-for-seo.com fix.
11/29/2018: Added local-seo-for-multiple-locations.com fix.
11/14/2018: Added seo-b2b.com fix.
11/07/2018: Added affordable-link-building.com fix.
11/01/2018: Added free-seo-consultation.com fix.
10/27/2018: Added get-seo-help.com fix.
10/13/2018: Added the solution to fix seo-services-with-results.com Analytics spam
10/10/2018: Added the solution to fix better-seo-promotion.com spam.
09/27/2018 11:57 PM: Blimey! It seems like they’re targeting me for writing this blog post.
09/27/2018 11:16 PM: Added the Cloudflare method to block servers that spam your website.
09/25/2018: This guide has the solution to fix your-seo-promotion-service.com-spam, my-seo-promotion-service.com, and other domains that spam Google Analytics. Just change the domain name/URL accordingly. I’ve added a new .htaccess method also (future-proof).

Exclude a single referrer

How to Block your-seo-promotion.com Analytics Spam (September 2018)

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the view in which you want to create the filter.
  3. In the VIEW column, click Filters.
  4. Click + New Filter. (If you can’t see this button, you do not have the necessary permission.)
  5. Select Create new Filter.
  6. Enter a name for the filter. Let’s name it enter-url-1.xyz.
  7. Set the Filter Type to Custom.
  8. Click the Select filter type drop-down menu and select Exclude.
  9. Now Set the Filter field to Campaign Source.
  10. Enter the Filter Pattern. In this case, add enter-url-1.xyz (the-spam-domain-name.tld) and click Save.

To Exclude multiple referrers

You can use the regular expression in the Filter Pattern field to exclude several referring sources.

i.e., If you want to add multiple URLs, make a filter pattern separated by a | (pipeline).

Example:

otherspammysite\.com|*enter-url-1\.xyz

Visit this link to learn more about setting filters on different levels. You may also set the Language Settings Filter and Campaign Referral Path Filter as well.

Block Analytics Spam in .htaccess

Applying filters is more like a band-aid solution. The spam sites are still sending traffic to your website, and GA doesn’t show it. Want to block the referral sites before they get to your site? There are two methods to block referral spam using .htaccess.

1. The Easy Method

You have to be careful when editing .htaccess files, as a small mistake can make your website stop working or throw a server error loop. So have a backup! Copy and paste the old content of .htaccess file somewhere safe before proceeding.

Usually, the .htaccess file goes to the root of your website (/public_html for example, the same location of wp-config.php). If there is none, you can create a new file. But watch out not to create something like “.htaccess.txt” if you do it with notepad (which usually appends .txt to all files).

The location may vary according to where you installed WordPress inside the host. Edit the .htaccess file and add the following line:

# BLOCK ANALYTICS SPAM
RewriteEngine on
RewriteCond %{HTTP_REFERER} enter-url-1\.xyz [NC, OR]
RewriteCond %{HTTP_REFERER} wakeupseoconsultant\.com [NC, OR]
RewriteCond %{HTTP_REFERER} example-spam-website\.com [NC]
RewriteRule .* - [F]

(Copy and paste the code in the bottom of your .htaccess.)

Note: Check whether a RewriteEngine On line is already inside your .htaccess file. Then you don’t need to copy that particular line from the code I shared. RewriteEngine only needs to occur once in the file, preferably at the top.

2. Find Spam Site’s Server IP Address & Block it

There are chances the spammer may spin up more domain names for this unholy practice. Solution? Deny their server to access your website. Proceed at your own risk.

GeneratePress Review: Best Gutenberg-ready Theme in October 2021

Use a DNS lookup tool like mxtoolbox.com to check spam domain’s (enter-url-1.xyz in your case) IP address:

Find your-seo-promotion.com's Server IP Address

As you can see, 217.23.10.44 turns out to the unique IP of the domain.

However, you’ve to make sure the spammer is not using any CDN to hide their IP address. Look at Facebook.com for example:

Facebook CDN

Facebook, Inc. CDN uses specific IP ranges for delivering Facebook.com. Here’s a list of IP Ranges that Cloudflare use. Make sure that you identify the unique IP of spammer and not IP ranges of a CDN service.

Upon identifying the spam sever, edit the .htaccess file and add the following line:

# block spam referrer
Deny from 217.23.10.44

Make sure that you enter the correct IP address. Doing so will block all the spammy domains pointed to this server IP address.

Block Analytics Spam Using in NGINX

Open your nginx.conf file located in /etc/nginx/nginx.conf

Proceed at your own risk. Contact your host to confirm the location of nginx.conf file. Make sure you have root access to the host. Always have a backup! Copy and paste the old content of nginx.conf file somewhere safe before proceeding.

Add the following lines inside the http block:

# Referer spam

map $http_referer $spam_referer {
default 0;
include /etc/nginx/spam_referer.map;
}

Nginx’s map (ref) module lets you create variables in Nginx’s configuration file whose values are conditional — that is, they depend on other variables’ values. The map command can only be used inside of the http block.

Create An Analytics Spammer List

Create a new file in the NGINX root directory (‘/etc/nginx’) and name it ‘spam_referer.map’ to save a list of spam referrers:

"~*enter-url-1.xyz" 1;
"~*wakeupseoconsultant.com" 1;
"~*free-social-buttons.com" 1;
"~*15-reasons-for-seo.com" 1;
"~*99-reasons-for-seo.com" 1;
"~*another-example-spam-website.com" 1;

The “~*” means case-insensitive matching.

Now open /etc/nginx/sites_available/default and add the following lines to the server block:

# Referrer exclusions

if ($spam_referer) {
return 444;
}

444 Explained: Connection Closed Without Response is a non-standard status code used to instruct nginx to close the connection without sending a response to the client, most commonly used to deny malicious or malformed requests. This status code is not seen by the client, it only appears in nginx log files.

Verify & Restart Nginx Service

Run this command to verify the config:

nginx t

Restart nginx if the test is successful:

sudo service nginx restart

Block IPs in Cloudflare CDN

Cloudflare user? The Firewall tab on Cloudflare provides you with an interface that you can use to block or whitelist IP addresses or entire networks. Based on the results from mxtoolbox.com, you can block spammer’s IP using Cloudflare. Here’s how to do it:

  1. Log in to Cloudflare.
  2. Go to the Firewall app.
  3. Add an entry to the Access Rules and select the action.

As seen on support.cloudflare.com.

Good luck!

Help someone else by sharing this article. Thank you.

Need a hand?

Need help optimizing your website analytics, speed and search performance? Connect with me now.

Setup A ShadowsocksR Server On Amazon EC2

Learn how to install ShadowsocksR (not Shadowsocks) server on Amazon EC2 Ubuntu instance (Free Tier) easily. I set SSR in the title because it’s superior to Shadowsocks. The script included in this tutorial comes with the option to choose between Shadowsocks or ShadowsocksR during installation. It’s your call.

Heads up: unlike the DigitalOcean guide I posted before, this one involves fewer commands and scripts. 😉

Update 1: I recommend SocketPro, a dirt cheap option ($2.41/mo annual) if you prefer to rely on a service provider. Their services are top-notch and I’ve been using it for almost two years alongside my DIY servers. Click here to read my review.

Update 2: Thanks Janosch for pointing out the error in the installation script. I’ve updated it now.

Why ShadowsocksR?

ShadowsocksR is a fork of the original Shadowsocks project, claimed to be superior regarding security and stability.

Warning: Although this guide is intended to be 100% n00b friendly, there are chances you may face minor issues or errors during setup. Be prepared. Write to mail at m1q.net if you want me set it up for you for a small fee.

Prerequisites:

  1. Access to AWS console. (Requires one-time credit/debit card verification)
  2. Read more about EC2 Free Tier.
  3. SSH client.
  4. Patience.

Sign in to the AWS Console & Create an EC2 Instance

AWS may take you to the US region by default. It’s up to you to choose the location.

Select EC2 in the Compute Section

Select the Asian region (Tokyo or Singapore recommended) if you’re from China.

Click Launch Instance

Go on and read their Getting Started Guide if you’ve got enough time.

Select The Ubuntu Server 16.04 LTS

Ubuntu Server 16.04 LTS is Free Tier Eligible, and that’s what we’re going to use for this guide as well. Click Select and proceed to the next step.

Choose the Instance Type

Look for the t2.micro which is Free Tier eligible. Select it and click Review and Launch.

Configure Security Group

Open the TCP ports you’re going to use for ShadowsocksR. I’ve set Port Range from 8000–8083 for this guide. You can limit the source according to your preference. Click Review and Launch when you’re ready.

Create a New Key Pair

Create, download, and save keypairname.pem file in a safe place.

Congrats on the 60% progress. Now learn how to use PEM key on Mac before jumping to the big steps. Windows users, you have to convert PEM file to PPK. Please read it and come back to this article.

macOS: Copy The AWS Generated PEM File to a Safe Location

Here’s how to copy keypairname.pem to /Users/usrname/.ssh/ (hidden directory)

  1. Copy the keypairname.pem file.
  2. Open Finder, use the shortcut “Shift + Command + G” and type in /Users/usrname/.ssh/
  3. Paste the keypairname.pem file.

macOS: chmod 400 the PEM file

We have to set the right permissions for PEM file. Use the chmod command to make sure that your private key file isn’t publicly viewable. For example, if the name of your private key file is keypairname.pem, use the following command:

$ chmod 400 /Users/username/.ssh/keypairname.pem

Alright, it’s about time fellas! Let’s dive into the Terminal/Putty.

macOS: Uncheck this Sucker in Terminal Preferences (Recommended)

There are chances some users may get locale errors, it’s a best practice to uncheck this from Terminal Preferences.

SocketPro Shadowsocks Service Provider

Get SocketPro now if you need a cheap option. 100% working in China.

Connecting to the EC2 Instance

Let’s connect to your instance from Putty or Terminal:

macOS, via Terminal:

$ ssh -i /Users/username/.ssh/keypairname.pem [email protected]

!! Check your public IP from the corresponding AWS EC2 webpage.

Windows via Putty:

Load your PPK and connect to the server as the Ubuntu user

Switch User in EC2 instance

Once you’re inside the EC2 instance. Switch to the root user:

$ sudo su

Run The ShadowsocksR Auto-Installer

Script by @teddysun. Copy and paste each line separately.

$ wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
$ chmod +x shadowsocks-all.sh
$ ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log

This installer is intuitive and will guide you setup ShadowsocksR on your instance.

Note: It contains installers for other Shadowsocks packages as well.

The installer will generate and display the final config. It displays Private IP (not public IP). So make sure you use Public IP within client apps. As I mentioned EARLIER, you can find your public IP within the corresponding AWS EC2 instance page or run the command below to display the public IP

$ wget -qO- -t1 -T2 ipinfo.io/ip

Commands to start | stop | restart | check status

Shadowsocks-Python

$ /etc/init.d/shadowsocks-python start | stop | restart | status

ShadowsocksR:

$ /etc/init.d/shadowsocks-r start | stop | restart | status

Shadowsocks-Go:

$ /etc/init.d/shadowsocks-go start | stop | restart | status

Shadowsocks-libev:

$ /etc/init.d/shadowsocks-libev start | stop | restart | status

That’s it, congrats on the 100% progress.

Write to mail at m1q.net you want me to set it up for a small fee.

Join The Mailing List

Get tips on WordPress optimization, website hosting, and VPN/proxy optimization guides for expats in China. Subscribe via email. MailChimp automates the 8MP mailing list. The mailer won’t spam your inbox. You can unsubscribe at any time.

Setup A Shadowsocks Server on DigitalOcean

Shadowsocks is an open-source SOCKS5 proxy which, according to their official site, is designed to protect your internet traffic. As an expat in China, I have tried a few VPN services. The major downside of well-known providers is that their VPNs create one connection for all traffic (which is easier for China’s GFW to detect/block/slow down).

Recently, I tested Shadowsocks on an Ubuntu server based in Singapore and I must say I’m quite happy with SOCKS5 rather than the paid services. I know there are a bunch of tutorials out there on how to configure Shadowsocks. But, I’d like to be more precise providing the best tips and workarounds.

In this tutorial, you’ll learn how to install Shadowsocks and related packages on an Ubuntu server and bypass the Great Firewall of China.

Prerequisites

  1. A DigitalOcean droplet (preferably an Ubuntu or CentOS x64 server) / Cost: Starts from $5 per month. Feel free to sign-up with my referral link if you’re interested.
  2. Notepad++/Sublime Text Editor if you don’t prefer UNIX vi editor.
  3. SFTP/FTP client like WinSCP if you prefer a GUI.

How To Create A New Droplet In DigitalOcean

Note: I highly recommend new users to generate/set-up SSH keys while creating a droplet as they provide a more secure way of logging into a virtual private server with SSH than using a password alone.

Screenshot showing the creation of a droplet on DigitalOcean.com

How To Install Shadowsocks on Ubuntu 18.04

Let’s fire up putty or any other SSH client and log in to your server as root user.

Once you have logged in to the server, run the following command to update the packages:

$ apt-get update

Now, run the following commands to install Python then Shadowsocks:

$ apt-get install python-pip
$ pip install shadowsocks

Now install M2Crypto, which is the most complete Python wrapper for OpenSSL featuring RSA, DSA, DH, EC, HMACs, message digests, symmetric ciphers (including AES). Run the following commands to install M2Crypto:

$ apt-get install python-m2crypto
$ apt-get install build-essential

Since salsa20 and chacha20 are fast stream cyphers. Optimized salsa20/chacha20 implementation on x86_64 is even 2x faster than rc4 (but slightly slower on ARM). You must install libsodium to use them:

$ wget https://github.com/jedisct1/libsodium/releases/download/1.0.10/libsodium-1.0.10.tar.gz
$ tar xf libsodium-1.0.10.tar.gz && cd libsodium-1.0.10
$ ./configure && make && make install
$ ldconfig

After finishing up the steps above, we must create a .json file (config file) for Shadowsocks. In order to do this, fire up Vi editor or open your text editor and create a new file. Add these data to the file:

{
"server":"your_droplet's_IP_address",
"server_port":8000,
"local_port":1080,
"password":"your_password",
"timeout":600,
"method":"aes-256-cfb"
}

You can choose any encryption method from here.

Save the file as shadowsocks.json and copy it to the /etc folder.

Now start your Shadowsocks server. Run the following command to do so:

$ ssserver -c /etc/shadowsocks.json -d start

You can check the Shadowsocks log file, which is located in /var/log/shadowsocks.log to make sure everything is okay.

Now that you are almost done, we need to make sure Shadowsocks server will be started automatically during system reboots. Edit the file named /etc/rc.local to do so.

Open up /etc/rc.local and add the following content before the exit 0 line.

/usr/bin/python /usr/local/bin/ssserver -c /etc/shadowsocks.json -d start

Now you’re ready to roll.

Note: In the future, use this command: “ssserver -c /etc/shadowsocks.json -d stop” to stop the Shadowsocks server. and “ssserver -c /etc/shadowsocks.json -d restart” to restart.

Server Optimization

There are a number of ways to optimize your server, here are the best ones.

To increase the maximum number of file descriptors:

Edit the limits.conf file located in /etc/security/limits.conf and add the following two lines:

* soft nofile 51200
* hard nofile 51200

Now, temporarily stop the Shadowsocks server to set the ulimit.

Run:

$ ssserver -c /etc/shadowsocks.json -d stop

Now set the ulimit:

$ ulimit -n 51200

To optimize the kernels:

We can optimize the kernel parameters by editing the /etc/sysctl.conf file. Open up the file and add the following lines to the end of the document:

fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_mem = 25600 51200 102400
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = cubic

Save it and run this command:

$ sysctl -p

Now that you finished optimizing, start the server!

$ ssserver -c /etc/shadowsocks.json -d start

Shadowsocks Clients:

Check out the clients for different platforms listed on Shadowsock’s official website.

Donate 捐赠 捐赠