L42y's Code Snippets

CSS

emulate borders with inset box shadows 1

border box-shadow
border: 1px solid red box-shadow: inset 0 0 0 -1px red
border-top: 1px solid red box-shadow: inset 0 1px 0 0 red
border-right: 1px solid red box-shadow: inset -1px 0 0 red
border-bottom: 1px solid red box-shadow: inset 0 -1px 0 0 red
border-left: 1px solid red box-shadow: inset 1px 0 0 red

JavaScript

Python

Shell

install npm package from GitHub respository   node npm GitHub

sudo npm install -g marijnh/tern#mater

make pacman-key –init super fast   Arch Pacman

rngd -f -r /dev/urandom
pacman-key --init

remove git tag (both local and remote)   git

git tag -d 0.1.0
git push origin :refs/tags/0.1.0

Emacs

ssh into remote host with sudo

C-x C-f /ssh:you@remotehost|sudo:remotehost:/path/to/file RET

SQL

PostgreSQL

create user 2

createuser [-d] [-s] username
# [-d] The new user will be allowed to create databases.
# [-s] The new user will be a superuser.

create database 3

createdb [-O] database
# -O Specifies the database user who will own the new database

locate config file 4

SHOW config_file;

MySQL

create user 5

CREATE USER 'user'@'localhost' IDENTIFIED BY 'cleartext password';

grant privilege 6

GRANT USAGE ON *.* TO 'user'@'localhost' WITH MAX_QUERIES_PER_HOUR 90;
  • grant all privilege
    GRANT ALL ON dbname.* TO 'user'@'localhost';
    
  • grant particular privilege
    GRANT SELECT ON dbname.tablename TO 'user'@'localhost';
    
  • grant database with particular prefix
    GRANT ALL ON `dbprefix\_*`.* TO 'user'@'localhost';
    

set password 7

SET PASSWORD FOR 'user'@'localhost' = PASSWORD('cleartext password');

Footnotes: