├── .gitignore ├── Go.md ├── Html.txt ├── Javascript.md ├── LICENSE ├── PostgreSQL.md ├── README.md ├── Redis.md ├── archlinux-installation.md ├── bash.md ├── django_query_debug.md ├── docker.md ├── git.md ├── mongo.md ├── mysql.md ├── nmap.md ├── regex.md └── sqlite.md /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.DS_Store 3 | -------------------------------------------------------------------------------- /Go.md: -------------------------------------------------------------------------------- 1 | ###Basic Types 2 | * bool 3 | * string 4 | * int, int8, int16, int32, int64 5 | * uint, uint8, unit16, unit32, unit64, unitptr 6 | * byte(unit8) 7 | * rune(int32), like a char 8 | * float32, float64 9 | * complex64, complex128 10 | 11 | ###Other Types 12 | * Array 13 | * Slice 14 | * Struct 15 | * Pointer 16 | * Fucntion 17 | * Interface 18 | * Map 19 | * Channel 20 | 21 | #### Variable Declaration 22 | ``` 23 | var 24 | var hiren string 25 | var a, b , c int 26 | ``` 27 | ######Or 28 | ``` 29 | var hiren = "Yo :D!" 30 | ``` 31 | ######Or 32 | ``` 33 | hiren := "Shorthand Yo! :/ " 34 | ``` 35 | #####Multi Initialization 36 | ``` 37 | var = 38 | var hiren, nish, nan int= 1 , 2 , 3 39 | ``` 40 | ######shortform :D 41 | ``` 42 | hiren, nish, nan := 1, "srting", false 43 | ``` 44 | 45 | #####Pointer 46 | ``` 47 | var * 48 | var xoxo := "o_O" 49 | var pointermama string = &xoxo 50 | ``` 51 | ######Pointer assignment 52 | ``` 53 | *pointermama = "another value" 54 | ``` 55 | #####Struct 56 | ``` 57 | type struct { 58 | 59 | } 60 | 61 | //example 62 | type Hiren struct { 63 | nan string 64 | nish string 65 | } 66 | 67 | //assinment 68 | var prism = Hiren{ "Example", "example" } 69 | //or 70 | var prism = Hiren{ nish : "Example", nan: "example } 71 | //or 72 | var prism = Hiren{} 73 | prism.nan = "bla blah" 74 | prism.nish = "yo yo " 75 | 76 | //access 77 | fmt.Println(prism.nan) 78 | ``` 79 | #####Function 80 | ``` 81 | func Example( ){ 82 | return bla bla 83 | } 84 | 85 | func Hiren(hiren string) string { 86 | return 'hello' 87 | } 88 | ``` 89 | ######Multiple returns 90 | ``` 91 | func example( ) ( multiple return type separated by comma){ 92 | return 93 | } 94 | 95 | func example(hiren string) (string, string) { 96 | return 'hi', 'hello' 97 | } 98 | ``` 99 | ######Named returns 100 | ``` 101 | func example( ) ( multiple return type with name separated by comma){ 102 | return 103 | } 104 | 105 | func example(hiren string) (hi string, hello string) { 106 | hi = "hi" 107 | hello = "holla" 108 | return 109 | } 110 | ``` 111 | ######Variadic function 112 | passing unlimited value in the fucntion 113 | ``` 114 | func example( yo name ...string) string { 115 | return name[0] 116 | } 117 | ``` 118 | ######Closure 119 | ``` 120 | function Xoxo(yo string) function() int{ 121 | return func() int { 122 | return 1 123 | } 124 | } 125 | ``` 126 | #####Branching 127 | ######If 128 | ``` 129 | if ; { //brackets are not optional for on liner ! 130 | // 131 | } 132 | 133 | if a := 1; a == ! { 134 | // 135 | }else { 136 | // 137 | } 138 | ``` 139 | ######Switch 140 | >No default fall through 141 | >Dont need an expression 142 | >Cases can be expressions 143 | ``` 144 | switch { 145 | case : 146 | default : 147 | } 148 | ``` 149 | ``` 150 | exm := 'hiren' 151 | switch exm { 152 | case 'hiren':fmt.Print("hiren") 153 | } 154 | ``` 155 | 156 | ######Fallthrough in Switch 157 | ``` 158 | yo := "boy" 159 | switch yo{ 160 | case "boy" : 161 | x := 1 162 | fallthrough 163 | case "yo": 164 | x := 2 165 | } 166 | ``` 167 | ###### Multiple case in Switch 168 | ``` 169 | yo := "boy" 170 | switch yo{ 171 | case "boy", "man" : // It can be list or whatever ! :P 172 | x := 1 173 | fallthrough 174 | case "yo": 175 | x := 2 176 | ``` 177 | ###### Use conditions in Switch 178 | ``` 179 | yo := "boy" 180 | switch{ 181 | case yo == "boy" , len(yo) == 2: 182 | x := 1 183 | case yo == "yo": 184 | x := 2 185 | ``` 186 | 187 | ######Loops 188 | ``` 189 | for i:=0; i < example; i++ { 190 | //block 191 | } 192 | ``` 193 | -------------------------------------------------------------------------------- /Html.txt: -------------------------------------------------------------------------------- 1 | Text tag : 2 | paragraph tag :

3 |

// align = center,left,right,justify 4 | 5 | break tag :
//left,right ,all 6 | non breaking space :   7 | 8 | phrase tag : // emphasize 9 | 10 | 11 | 12 | hiren 13 | hiren 14 | hiren says 15 | 16 | 17 | 18 | font tag : 19 | 20 | 21 | / 22 | 23 | 24 | 25 | 26 | heading tag :

//h1~h6 27 | 28 | quotes tag :
29 | 30 | preformat tag :

31 | 
32 | Font tag : 
33 | 
34 | 
35 | List tag : ordered list 
    // type = A , a , I ,i , upper-roman,lower-roman , upper-alpha , lower - alpha ,number 36 | unordered list
    // type=disc,circle , square 37 | definition list
    38 |
    39 |
    40 | 41 |
    42 | 43 | 44 | Image tag : 45 | 46 | 47 | 48 | 49 | Link tag: 50 | 51 | 52 | 53 | Table tag: 54 | 55 | 58 | 59 | 60 | 61 | 62 | set = where = 48 | ``` 49 | Data Types 50 | 51 | Type | Name 52 | --------|----------- 53 | Numerical | Integer,float,numeric,real , serial 54 | Character | char , varchar , text 55 | Logical | Boolean 56 | Temporal | Date , Time , Timestamp ,Interval , Timestamptz 57 | Binary | Bytea , Bit , Bit Varying 58 | Geo-Spatial | Point , Path , Polygon , Circle , Line 59 | Internet | Inet , Cidr , Macaddr 60 | Special | Enum , Range , Json , Xml ,Oid 61 | Array | [] 62 | Composite type | Type 63 | 64 | ###CLI 65 | change to postgres user and open psql prompt 66 | ``` 67 | sudo -u postgres psql postgres 68 | ``` 69 | list databases 70 | ``` 71 | postgres=# \l 72 | ``` 73 | list roles 74 | ``` 75 | postgres=# \du 76 | ``` 77 | create role 78 | ``` 79 | postgres=#CREATE ROLE demorole1 WITH LOGIN ENCRYPTED PASSWORD 'password1' CREATEDB; 80 | ``` 81 | alter role 82 | ``` 83 | postgres=#ALTER ROLE demorole1 CREATEROLE CREATEDB REPLICATION SUPERUSER; 84 | ``` 85 | drop role 86 | ``` 87 | postgres=#DROP ROLE demorole1; 88 | ``` 89 | create database 90 | ``` 91 | postgres=#CREATE DATABASE demodb1 WITH OWNER demorole1 ENCODING 'UTF8'; 92 | ``` 93 | grant privileges to new user 94 | ``` 95 | GRANT ALL PRIVILEGES ON DATABASE demodb1 TO demorole1; 96 | ``` 97 | drop database 98 | 99 | ``` 100 | postgres=#DROP DATABASE demodb1; 101 | ``` 102 | connect to database 103 | 104 | ``` 105 | \c 106 | ``` 107 | list tables in connected database 108 | 109 | ``` 110 | \dt 111 | 112 | ``` 113 | list columns on table 114 | 115 | ``` 116 | \d 117 | ``` 118 | backup database 119 | ``` 120 | pg_dump > 121 | ``` 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Personal cheat sheet :smile: 2 | -------------------------------------------------------------------------------- /Redis.md: -------------------------------------------------------------------------------- 1 | ###Redis datastructures 2 | ``` 3 | string , list , hash , set and sorted set 4 | ``` 5 | ####String 6 | ######Set value 7 | ``` 8 | set 9 | set name "hiren" 10 | ``` 11 | ######Get value 12 | ``` 13 | get 14 | get name #return "hiren" 15 | ``` 16 | ######Get value using range 17 | ``` 18 | getrange 19 | getrange name 0 3 #return "hire" 20 | ``` 21 | ######Set value using range 22 | ``` 23 | setrange 24 | setrange name 5 RST 25 | ``` 26 | ######Override value 27 | ``` 28 | getset 29 | getset name "Rater Santo Tara" 30 | ``` 31 | ######Multiset value 32 | ``` 33 | mset 34 | mset name "Rater Santo Tara" age 20 35 | ``` 36 | ######Increment value (only works for numbers) 37 | ``` 38 | incr age ## increment age by 1 39 | ``` 40 | ######Decrement value 41 | ``` 42 | decr 43 | ``` 44 | ######Increment and decrement by specific number 45 | ``` 46 | incrby 5 47 | decrby 20 48 | ``` 49 | ######Float increment (only for integer ) 50 | ``` 51 | incrbyfloat 52 | ``` 53 | ######Set expire time 54 | ``` 55 | setex
    56 | Hiren 57 |