Remove file from a git repository
Remove file from git repository
1 | git rm --cached filepath
|
Discover code snippets, tutorials, and programming insights
Remove file from git repository
1 | git rm --cached filepath
|
<p>When you run this code, it will fetch the geocoding results for the provided address and print the JSON representation of those results with proper indentation, making it easy to …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import json
from pygeocoder import Geocoder
business_geocoder = Geocoder(api_key='my_google_api_key')
results = business_geocoder.geocode("address")
# Get a dictionary representation of the geocoding results
json_result = results.serialize()
# Convert the dictionary to a JSON string with indentation
json_string = json.dumps(json_result, indent=4)
# Print the JSON string
print(json_string)
|
Reset mysql root password
1 2 3 4 5 6 7 8 | use mysql;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD("pass");
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Current-Root-Password';
FLUSH PRIVILEGES;
quit;
service mysql restart
mysql -u root -p
|
Python3 requests with authentication
1 2 3 4 5 6 | def get_data(auth_user, auth_passwd, url):
headers = {'Accept': 'application/json'}
response = requests.get(
url, auth=requests.auth.HTTPBasicAuth(
auth_user, auth_passwd), headers=headers)
return json.loads(response.text)
|
Python3 Uwsgi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | sudo pip3 install uwsgi
sudo mkdir /etc/uwsgi
sudo mkdir /etc/uwsgi/vassals
sudo nano /etc/systemd/system/emperor.uwsgi.service
Contents of emperor.uwsgi.service file
---------------------------------------------------------------------------------------
[Unit]
Description=uWSGI Emperor
After=syslog.target
[Service]
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi/emperor.ini
# Requires systemd version 211 or newer
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target
--------------------------------------------------------------------------------
systemctl start emperor.uwsgi.service # start as service
systemctl enable emperor.uwsgi.service # add service at boot
touch /etc/uwsgi/emperor.ini
sudo nano /etc/uwsgi/emperor.ini
Contents of emperor.ini file
----------------------------------------------------------------------------------------------
[uwsgi]
emperor = /etc/uwsgi/vassals
vassal-set = processes=8
vassal-set = enable-metrics=1
------------------------------------------------------------------------------------------
|