Site Tools


Hotfix release available: 2024-02-06a "Kaos". upgrade now! [55.1] (what's this?)
New release available: 2024-02-06 "Kaos". upgrade now! [55] (what's this?)
onny:notizen:programmierung

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
onny:notizen:programmierung [2022/09/13 10:47] – [mysql] 10.25.0.100onny:notizen:programmierung [2023/11/07 15:40] (current) – [sql] 127.0.0.1
Line 56: Line 56:
 date = datetime.datetime.now().strftime("%d.%m.%Y") date = datetime.datetime.now().strftime("%d.%m.%Y")
 </code> </code>
 +
 requests requests
 +
 <code python> <code python>
 import requests import requests
Line 66: Line 68:
 if (upstream_head.headers['content-type'] == "text/html;charset=UTF-8" or upstream_head.headers['content-type'] == "text/html; charset=UTF-8"): if (upstream_head.headers['content-type'] == "text/html;charset=UTF-8" or upstream_head.headers['content-type'] == "text/html; charset=UTF-8"):
     upstream_response = upstream_response.replace("//thepiratebay.org","")     upstream_response = upstream_response.replace("//thepiratebay.org","")
 +</code>
 +
 +class example
 +
 +<code python>
 +class Planday:
 +  auth_url = 'https://id.planday.com/connect/token'
 +  client_id = '1234'
 +  access_token = ''
 +
 +  def authenticate(self):
 +    payload = {
 +      'client_id': self.client_id,
 +      'refresh_token': 'qyS6qt9yNEqygE1mMQtRzA',
 +      'grant_type': 'refresh_token'
 +    }
 +    headers = {
 +      'Content-Type': 'application/x-www-form-urlencoded'
 +    }
 +    session = requests.session()
 +    session.trust_env = False
 +    response = session.request("POST", self.auth_url, headers=headers, data=payload)
 +    response = json.loads(response.text)
 +    self.access_token = response['access_token']
 +
 +planday = Planday()
 +planday.authenticate()
 </code> </code>
 ==== ponyorm ==== ==== ponyorm ====
Line 265: Line 294:
  
 <code javascript> <code javascript>
-var anchors = document.getElementsByClassName('wp-block-navigation-item__content'); +# old: var anchors = document.getElementsByClassName('wp-block-navigation-item__content'); 
-for(var i 0; i < anchors.length; i++{ +let allCheckBox document.querySelectorAll('.shapes'
-    var anchor anchors[i]; + 
-    anchor.onclick function() { +  allCheckBox.forEach((checkbox) => {  
-        console.log('clicked');+  checkbox.addEventListener('change', (event) => { 
 +    if (event.target.checked) { 
 +      console.log(event.target.value)
     }     }
-}+  }
 +})
 </code> </code>
  
Line 279: Line 311:
 var element = document.getElementsByClassName('wp-block-navigation__responsive-container')[0]; var element = document.getElementsByClassName('wp-block-navigation__responsive-container')[0];
 element.classList.remove("is-menu-open"); element.classList.remove("is-menu-open");
 +</code>
 +
 +get url and pathname
 +
 +<code javascript>
 +console.log(window.location.url)
 +console.log(window.location.pathname)
 +</code>
 +
 +querySelector, get child element
 +
 +<code javascript>
 +var h3 = document.querySelector('div.multicolumn ul li:nth-child(1) h3')
 +console.log(h3.textContent);
 +h3.querySelector('span');
 +</code>
 +
 +querySelectorAll
 +
 +<code javascript>
 +var productAccordion = document.querySelectorAll('div.product__accordion');
 +productAccordion[1].style.display = "none";
 +</code>
 +
 +get next or previous element
 +
 +<code javascript>
 +document.getElementById('foo2').nextSibling; // #foo3
 +document.getElementById('foo2').previousSibling; // #foo1
 </code> </code>
 ==== vuejs ==== ==== vuejs ====
Line 453: Line 514:
       }       }
 </code> </code>
-===== css ===== 
-sweet font styling 
-<code css> 
-font-family: consolas,Menlo-Regular,Menlo,Monaco,monospace; 
-    font-size: 125%; 
-    line-height: 135%; 
-</code> 
-media queries, page greater than 600px 
-<code css> 
-      @media (min-width: 600px) { 
-        article { 
-          min-width: 600px; 
-        } 
-      } 
-</code> 
-popover menu 
-<code css> 
-.main-navigation ul li ul.sub-menu { 
- opacity: 0; 
- position: absolute; 
-  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26); 
- transition:opacity 250ms ease-out; 
- padding: 20px; 
- z-index: 2; 
- left: 17px; 
- background: white; 
-} 
  
-.main-navigation ul li:hover ul.sub-menu { 
- opacity: 1; 
- transition:opacity 250ms ease-out; 
-} 
-</code> 
- 
-responsive grid layout 
-<code> 
-ul { 
- display: grid; 
- grid-gap: 50px 40px; 
- grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); 
-} 
-</code> 
 ===== php ===== ===== php =====
 enable debugging / error log enable debugging / error log
Line 726: Line 746:
 </code> </code>
 ===== sql ===== ===== sql =====
-Update field: 
-<code sql> 
-update forwardings set destination='alex.bloss@online.de' where 'destination=bloss@bigwood.de'; 
-</code> 
-Insert field: 
-<code sql> 
-insert into forwardings (source, destination) VALUES ('markus.heim@wew-heim.de', 'heimmarkus@yahoo.de'); 
-insert into forwardings VALUES ('markus.heim@wew-heim.de', 'heimmarkus@yahoo.de'); 
-</code> 
-Delete row: 
-<code sql> 
-delete from domains where domain='alex-vt.de'; 
-</code> 
 <code sql> <code sql>
 mysql> \P /usr/bin/less mysql> \P /usr/bin/less
Line 759: Line 766:
  
 ==== mysql ==== ==== mysql ====
- 
-Dump database 
-<code bash> 
-mysqldump -u root -p Tutorials > tut_backup.sql 
-</code> 
- 
-Backup everything 
-<code bash> 
-mysqldump -u root -p --all-databases > alldb.sql 
-</code> 
- 
-Import database 
-<code> 
-mysql> CREATE DATABASE wordpress; 
-sudo mysql -u root wordpress < wordpress.sql 
-</code> 
- 
-Setup 
-<code bash> 
-systemctl stop mysqld 
-mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 
-systemctl start mysqld 
-mysql_secure_installation 
-</code> 
  
 delete specific row delete specific row
Line 797: Line 780:
 <code sql> <code sql>
 CREATE USER 'ninja'@'http.pi' IDENTIFIED BY '****'; CREATE USER 'ninja'@'http.pi' IDENTIFIED BY '****';
-GRANT ALL PRIVILEGES ON `ninja`.* TO 'ninja'@'http.pi';+GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'http.pi' identified by '123'; 
 +GRANT ALL PRIVILEGES ON ninja.* TO 'ninja'@'http.pi';
 FLUSH PRIVILEGES; FLUSH PRIVILEGES;
-</sql> 
-==== postgresql ==== 
- 
-drop database 
-<code bash> 
-sudo -u postgres -i 
-dropdb onlyoffice 
 </code> </code>
  
-list databases +update statement
-<code> +
-psql# \l +
-</code>+
  
-dump database +<code sql
-<code> +UPDATE wp_options SET option_value = 'info@example.org' WHERE option_name = 'admin_email';
-pg_dump -U gitlab gitlabhq_production > /tmp/gitlab.pgsql+
 </code> </code>
  
-dump all 
-<code> 
-pg_dumpall > /tmp/dump_file_name.tar 
-</code> 
- 
-import database 
-<code> 
-psql# CREATE DATABASE gitlabhq_production; 
-psql -U gitlab gitlabhq_production < gitlab.pgsql 
-</code> 
- 
-create and delete user 
-<code> 
-DROP ROLE gitlab; 
-CREATE USER gitlab WITH PASSWORD '5V0hD0KWX81g5dhKGHsbqU4a'; 
-</code> 
- 
-grant permissions 
-<code> 
-ALTER USER gitlab SUPERUSER; 
-CREATE DATABASE gitlabhq_production OWNER gitlab; 
-ALTER DATABASE gitlabhq_production OWNER TO gitlab; 
-</code> 
onny/notizen/programmierung.1663066064.txt.gz · Last modified: 2022/09/13 10:47 by 10.25.0.100