jan

33 notes

about 2 months ago
It's about meaning not money

Make meaning
Anticipate needs
Jump to the next curve
Empowering
Let 100 followers blosson
Nice thyself
Unique + value, to right corner
Churn baby churn
Make big challenges
Change your mind
Don't let the bozos grind you down

3 months ago
When you're 90% done... you still have 90% to go

In other words you need to 10x
5 months ago
Install redis on Mac
$ brew install redis

Start redis
$ redis-server /usr/local/etc/redis.conf

Config file
$ cat /usr/local/etc/redis.conf

Test if redis is running
$ redis-cli ping


5 months ago
Mastodon commands

Show log
$ journalctl -xf -u mastodon-*

Start instance
$ systemctl start mastodon-*.service

Stop instance
$ systemctl stop mastodon-*.service

Status of instance
$ systemctl status mastodon-*.service

Enter rails console
$ RAILS_ENV=production bundle exec rails c

Switch to mastadon user
$ sudo su - mastodon

Enter postgres
$ psql

Show databases
=> \l

Quit postgres
=> \q


5 months ago
Git checkout the latest tagged version

$ git tag -l

$ git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)


5 months ago
Reduce your server's resource usage by moving #MySQL temporary directory to tmpfs for better #performance

https://2bits.com/articles/reduce-your-servers-resource-usage-moving-mysql-temporary-directory-ram-disk.html


5 months ago

Traction Thinking


Spend 50% of your time on product and 50% on traction.

Why?

It helps you build the right product.
  • get feedback from early customers
  • what features are missing
  • which part of the experience are broken

You can think of your initial investment in traction as pouring water into leaky bucket. At first your bucket will be very leaky because your product is not yet a full solution to customer needs and problems. In other words, your product is not as sticky as it could be, and many customers will not want to engage with it yet. As a consequence, much of the money your are spending on traction will leak out of your bucket. If you don't interact with cold customers in this way, then you generally spend time on the wrong things in terms of product development.

Test different traction channels before you launch anything.


5 months ago
Show installed python packages

pip list

Install a new python package

pip install package_name

Mac OSX upgrade package

pip install --user --upgrade matplotlib

#pip
6 months ago
“everything in the world was created by people no smarter than you”. You can do whatever you want, once you realize one secret: everything big starts small. -Steve Jobs 

#quotes 
6 months ago
How to copy files from one server to another using #ssh on #linux

scp <source> <destination>

To copy a file from B to A while logged into B:
scp /path/to/file username@a:/path/to/destination

To copy a file from B to A while logged into A:
scp username@b:/path/to/file /path/to/destination


6 months ago
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

vi .bundle/config

change the BUNDLE_FROZEN

BUNDLE_FROZEN: "false"

again "bundle install"

#bundler #ruby 


6 months ago
Show physical CPUs on #mac

$ sysctl -n hw.physicalcpu

Logical CPUs

$ sysctl -n hw.logicalcpu

6 months ago
Install redis on macOS

$ brew install redis

Start redis-server

$ brew services start redis

Test if Redis server is running

$ redis-cli ping

If it replies “PONG”, then it’s good to go!

#mac #redis #brew



6 months ago

OS X Screencast to animated GIF


To capture the video, using the free "QuickTime Player" application:

  • Open "Quicktime Player",
  • Go to File -> New Screen Recording
  • Selected screen portion by dragging a rectangle, recorded 13 second video.
  • Go to File -> Export -> As Movie
    • Saved the video in full quality with the filename in.mov
To convert in.mov into out.gif, open Terminal to the folder with in.mov and run the following command:

ffmpeg -i in.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif


Notes on the arguments:

  • -r 10 tells ffmpeg to reduce the frame rate from 25 fps to 10
  • -s 600x400 tells ffmpeg the max-width and max-height
  • --delay=3 tells gifsicle to delay 30ms between each gif
  • --optimize=3 requests that gifsicle use the slowest/most file-size optimization

Installation
The conversion process requires the following command-line tools:

  • ffmpeg to process the video file
  • gifsicle to create and optimize the an animated gif
If you use homebrew and homebrew-cask software packages, just type this in:

brew install ffmpeg 
brew cask install x-quartz #dependency for gif...
6 months ago

Let's encrypt a 100 MB file using the latest browser - WebCrypto API Speed Test 


How long does it take to encrypt a file using the WebCrypto API on the latest browsers? We measured the speed on Firefox, Chrome, Safari, Opera, and IE11 does support Web Cryptography, but that's based on an old version of the spec. https://caniuse.com/#feat=cryptography

The W3C Recommendation from 26 January 2017 describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. https://www.w3.org/TR/WebCryptoAPI/

Test setup: 2,4 GHz Intel Core i5, 16 GB 1333 MHz DDR3, Intel HD 3000 512 MB, running macOS Sierra v10.12.6.
JavaScript encryption library: OpenPGP.js v3.0.3 https://github.com/openpgpjs/openpgpjs

And the winner is Firefox 59!

25 MB -> 3.0 seconds
50 MB -> 5.8 seconds
100 MB -> 14.2 seconds

2. Safari 11

25 MB -> 4.2 seconds
50 MB -> 7.3 seconds
100 MB -> timeout

3. Chrome 65

25 MB -> 10.0 seconds
50 MB -> 19.1 seconds
100 MB -> timeout

4. Opera 52
6 months ago
#rvm #ruby 

If you want create the .ruby-version and .ruby-gemset file in a short way you can use the commands like this:

rvm use 2.3.3@appname --create
.ruby-gemset

rvm --create --ruby-version 2.3.3@appname
.ruby-version


6 months ago
Create new user in #mysql and grant privileges

> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

> CREATE DATABASE IF NOT EXISTS db_name;

> GRANT ALL PRIVILEGES ON db_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';
6 months ago
#Rails #mysql2 gem compatibility

  • mysql2 0.4.x works with Rails / Active Record 4.2.5 - 5.0 and higher.
  • mysql2 0.3.x works with Rails / Active Record 3.1, 3.2, 4.x, 5.0.
  • mysql2 0.2.x works with Rails / Active Record 2.3 - 3.0.
6 months ago
#openpgpjs / https://github.com/openpgpjs / version 2.0

Load public key

> var pubkey = "-----BEGIN PGP PUBLIC KEY BLOCK----- ... "
> openpgp.key.readArmored(pubkey)

Get all primary keys

> openpgp.key.readArmored(pubkey).keys

Get expiration time of primary key

> openpgp.key.readArmored(pubkey).keys[0].getExpirationTime()

Get all sub keys

> openpgp.key.readArmored(pubkey).keys[0].subKeys

Get expiration time of a sub key

> openpgp.key.readArmored(pubkey).keys[0].subKeys[0].getExpirationTime()

Check if primary key is valid

> openpgp.key.readArmored(pubkey).keys[0].verifyPrimaryKey()

Check if sub key is valid

> openpgp.key.readArmored(pubkey).keys[0].subKeys[0].verify(openpgp.key.readArmored(pubkey).keys[0].primaryKey)

Key status

> openpgp.enums.keyStatus

Object {invalid: 0, expired: 1, revoked: 2, valid: 3, no_self_cert: 4}





6 months ago
See what rules are already configured
iptables -L
Edit iptables
/etc/iptables.test.rules
Activate these new rules
iptables-restore < /etc/iptables.test.rules
Check the diff 
iptables -L
Save the new rules to the master iptables file
iptables-save > /etc/iptables.up.rules

#debian #iptables


Syntax to block an IP address under Linux

iptables -A INPUT -s IP-ADDRESS -j DROP



7 months ago
Full unicode support in #mysql 

For each database:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;

For each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

For each column:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Database config in #rails

production:
  # ...
  encoding: utf8mb4
  collation: utf8mb4_bin
7 months ago
Show #python version in #zeppelin in #pyspark

%pyspark

import sys
sys.version

Show #spark version

sc.version


7 months ago
check RTP record / #dns

$ dig -x ip-address

7 months ago
test #sendmail

% echo "test message" | sendmail -v reciver@me.com
7 months ago

Show running #docker containers
$ docker ps -a

Build container
$ docker build -t pyspark3:latest -f Dockerfile .

Create container from image
$ docker run -it -v $(pwd):/opt/doc/working_dir -p 8888:8888 --name work pyspark3

Start container 
$ docker start -ai work

Stop container
$ docker stop work


7 months ago
List files in #HDFS

$ hdfs dfs -ls /

List dfs report

$ hdfs dfsadmin -report