How To Set CPU Affinity for OBS Studio 64bit

Please reference this thread on how to generate the hexadecimal for the affinity command: https://www.eightforums.com/threads/cpu-affinity-shortcut-for-a-program-create-in-windows.40339/

I have a 16 core (i9 9900k), my hexadecimal is f (CPU0, CPU1, CPU2, CPU3)

The standard recommendation is to create a desktop shortcut… but there is an issue with this I mention below.

C:\Windows\System32\cmd.exe /c start “OBS Studio (64bit)” /affinity F “C:\Program Files\obs-studio\bin\64bit\obs64.exe”

When I open the shortcut, I get OBS gives me two error prompts

“Failed to find locale/en-US.ini”
“Failed to load locale”

I’ve noticed other forum discussions where people suggesting to cd to the OBS Studio directory. They were using a batch file. I opened up notepad and saved a file to my desktop called “obs.bat” and inserted the 2 lines below:

cd “C:\Program Files\obs-studio\bin\64bit\”
C:\Windows\System32\cmd.exe /c start “OBS Studio” /affinity F “C:\Program Files\obs-studio\bin\64bit\obs64.exe”

Now, I’m not sure how well optimize this will run… I’m streaming single PC, 720p at 60fps. I’d like to bump it to 1080p 60fps, however I don’t want to impact my game FPS or have OBS take a performance hit either.

Give this a try and let me know in the comments below how well it performs!

Read More

Caught The Raspberry Pi Bug!

I’ve recently caught the Raspberry Pi bug when I walked into Fry’s Electronics and started looking at all the awesome “Maker” gadgets on sale. I have always wanted to pick up a Pi and find a purpose for one in the household, and I’ve recently fallen in love with Raspbian and Kali Linux.

Photo Credit Brennen Bearnes

My first Raspberry Pi 3 Model B I picked up at Fry’s electronics came bundled with a breadboard, LED lights, and basic resistors for learning. Unfortunately the documentation that’s supposed to be coupled with the kit wasn’t the best. I might revisit this in the future after finding the “Freenove RFID Starter Kit” with a link to a fairly up-to-date Github repository with thorough documentation.

Currently I am using the Raspberry Pi as a motivational piece of hardware to keep tinkering away with Linux based operating systems. I am currently using both Raspbian / Debian and Kali Linux on a single Pi. At the moment, I am only using the Pi as a sandbox I can easily SSH or VPN into and not have to worry about juggling VM’s locally. I also want to continue working with the hardware to get into more advanced adventures like setting up security cameras, lasers, perhaps load Docker onto a Pi!

With the announcement of Raspberry Pi 3+ I decided to purchase second board and have begin thinking about what I could possibly do with two… or more! I certainly would like to be apart of the #MakerRevolution!

Read More

Mendix: Generate Self Signed Outgoing Connections Certificates

Generate Outgoing Connections Certificate Tutorial How To

Below is how to generate a self signed certificate for Mendix Outgoing Connections. This procedure does not include authority certs. Java will kick back for generating self signed certs. You’ll need a certificate authority. Below are notes of the process for self signed.

Generate Private Key.

openssl genrsa 2048 > mxoutgoing.key

Generate Certificate Signing Request.

openssl req -new -key ./mxoutgoing.key > mxoutgoing.csr

Use CSR to generate certificate and sign with private key.

Note: Common Name should contain the domain intended to use.

openssl x509 -in mxoutgoing.csr -out mxoutgoing.crt -req -signkey mxoutgoing.key -days 365

Create the pfx container using the Certificate, Key, and encrypt the container.

openssl pkcs12 -export -out mxoutcert.pfx -inkey mxoutgoing.key -in mxoutgoing.crt

Read More

Mendix On AWS

Provisioning a Mendix server instance on AWS EC2 we will use the base Amazon AMI image (flavor of CentOS).

Launch AWS EC2 Instance

$ sudo yum update

Installing Mendix Server/Tools on CentOS

Add additional repo location mendix.repo

$ sudo vi /etc/yum.repos.d/example.repo

[mendix]
name=Mendix
baseurl=”https://packages.mendix.com/platform/rpm/”
gpgcheck=0

$ sudo yum install m2ee-tools

Oracle Java JRE 8

JRE 8 is required for Mendix 6 and above. Below is the commands to grab linux-x64. Reference the link below to the Oracle downloads page for latest version.

sudo su

$ cd ~/

$ wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” \ “http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jre-8u151-linux-x64.rpm”

Perform localinstall

$ sudo yum localinstall jre-8u151-linux-x64.rpm

Citation: https://www.digitalocean.com/community/tutorials/how-to-install-java-on-centos-and-fedora http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Python Requirements

Check version

$ sudo su

# python --version
# pip install httplib2
Confirm
# pip list

Examples of m2ee config files are located at: /usr/share/doc/m2ee-tools-0.5.11.4/examples

Deployment Location

It’s highly recommended to create a separate user per mendix application you want to run on the application server. adduser example on m2ee-tools documentation does not have the same flags. –disabled-password and –gecos citation: https://github.com/mendix/m2ee-tools/blob/develop/doc/install-2.md

$ sudo adduser myfirstappz

Create filesystem location for the Mendix app

$ sudo mkdir -p /srv/mendix/myfirstappz
$ cd /srv/mendix/myfirstappz
$ sudo mkdir runtimes/ web/ model/ data/ data/database/ data/files/ data/model-upload/ data/tmp/
$ sudo chown myfirstappz:myfirstappz * -R
$ sudo chmod 700 model/ data/
$ sudo tree

AWS issue, this file structure methodology will not scale, need to consider other options on how to redeploy this in a stateless matter.

Configuring The Application

Going through the documentation on m2ee-tools, notes below. Note: might have to login as the app user (myapp) or root due to permissions https://github.com/mendix/m2ee-tools/blob/develop/doc/configure.md

Copy & Configure m2ee.yaml

$ cd /usr/share/doc/m2ee-tools-0.5.11.4/examples
$ mkdir ~/.m2ee
$ cp user-specific-m2ee.yaml ~/.m2ee/m2ee.yaml
$ sudo vi ~/.m2ee/m2ee.yaml

Config for m2ee goes in: ~/.m2ee/m2ee.yaml

Configuring NGINX

example config provided, lacks setting up nginix for this scenario.
https://github.com/mendix/m2ee-tools/blob/develop/doc/nginx.md

aws ubuntu example:
https://www.nginx.com/blog/setting-up-nginx/

$ sudo yum update
$ sudo yum install -y nginx
$ sudo service nginx start

example: http://ec2-34-212-160-182.us-west-2.compute.amazonaws.com/

configure nginx for myfirstappz

$ sudo vi /etc/nginx/nginx.conf

Set the Server->root to /srv/mendix/myfirstappz/web/

$ sudo nginx -s reload

Deploy Mendix App

Example MDA file on s3: https://s3-us-west-2.amazonaws.com/agents.exprealty.com/mda/mendixtest.mda

project location:

$ su myfirstappz myfirstappz@ip $ cd /srv/mendix/myfirstappz/data/model-upload
myfirstappz@ip $ wget https://s3-us-west-2.amazonaws.com/agents.exprealty.com/mda/mendixtest.mda

Launch m2ee and unpack the mda file

myfirstappz@ip $ m2ee
unpack mendixtext.mda

Run Mendix App For First Time

$ su myfirstappz
myfirstappz@ip $ m2ee
download_runtime
start

Read More

Access Forbidden! – XAMPP on macOS Sierra

I just installed a fresh installation of Sierra on my Hackintosh and couldn’t for the life of me get XAMPP to run properly! I got “Access Forbidden” on my localhost and vhosts.I figured I’d write a few notes for people that run into this issue running XAMPP on your Mac. Please comment below if you don’t agree with or see a flaw in my notes and I can test and update your feedback. This guide assumes you already know basics behind XAMPP/WAMP stacks and are stuck getting it running on OSX.

Are they rebranding OSX to macOS? I digress…

Setting Up httpd.conf & httpd-vhosts.conf

1.) Open up XAMPP and click the tab Manage Servers. Highlight Apache and click Configure. Click Open Conf File. This will open your httpd.conf file.

2.) In httpd.conf find the follow line of code and change it daemon to your OS X username. User daemon

3.) In httpd.conf find the following line and uncomment it (by removing the #) #Include etc/extra/httpd-vhosts.conf

Save the file, don’t close TextEditor

4.) In TextEditor, goto File -> Open. You should start out in xamppfiles/etc. Click into the extra directory and then open httpd-vhosts.conf

5.) Remove the example code -or- comment all of it out.

6.) Use the following code to base your vhosts on, keep in mind I kept the default localhost example just to access the default htdocs location. https://gist.github.com/wykydtronik/8c9e3b701ac138b19a7d012a34d34c6c

7.) Restart Apache services in XAMPP’s Manage Servers tab.

Solving Access Forbidden in XAMPP

This part is the one thing many would disagree with and I’m not 100% a way around this in macOS Sierra. Previously I’ve simply chmod 644 -R my working folders but I couldn’t for the life of me get around the forbidden error. If you know a better way around this please comment below.

1.) Open Terminal (Applications/Utilities/Terminal)

2.) cd to your directory and give execute read write permissions, example below $ sudo chmod -R +xrw wordpress/

If you’re new to this, the $ is just signifying the command line beginning and we’re not su. This should set execute/read/write permissions reclusively to all files and folders within our working directory. I haven’t tried it but you can also try chown but these directories are already owned by my user…

Setting Up Hosts File in OSX Sierra

If you’re not familiar with vhosts on a local XAMPP stack, the hosts file allows you to overwrite local DNS routing on your machine. In our scenario, we will one for our local wordpress environment.

1.) In terminal, simply use this command to open up the hosts file: $ sudo nano /private/etc/hosts

2.) At the bottom of the file add this to your hosts file: 127.0.0.1 wordpress.dev

This will now route traffic from http://wordpress.dev to your localhost. If your httpd.conf and httpd-vhosts.conf files are setup correctly, you can now access your local WordPress developer environment. Try to refresh http://localhost -or- for example http://wordpress.dev

Are you having troubles with this article? Please feel free to leave a comment below or Tweet me at @eddihughes – I can go through the article and update any steps that may have changed.

Read More

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

Useful MySQL Queries For WordPress Migration

See what’s hogging up your MySQL db


# query db to see the largest tables
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;

view raw

gistfile1.txt

hosted with ❤ by GitHub

Revisions Genocide


# revisions genocide
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( b.term_taxonomy_id = d.term_taxonomy_id)
WHERE a.post_type = 'revision'
AND d.taxonomy != 'link_category';

view raw

gistfile1.txt

hosted with ❤ by GitHub

Cluttered up DB, create a mass drop query


SELECT CONCAT( 'DROP TABLE `', TABLE_NAME, '`;' ) AS query
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE '%_gmp_%'

view raw

gistfile1.txt

hosted with ❤ by GitHub

Read More