Skip to content

Instantly share code, notes, and snippets.

View mohapsat's full-sized avatar
🏁
The future is built on dreams. Hang on to yours!

Satya Mohapatra mohapsat

🏁
The future is built on dreams. Hang on to yours!
View GitHub Profile
@mohapsat
mohapsat / CERTIFICATE_VERIFY_FAILED
Last active August 24, 2021 00:40
Fix for Mac OSX python ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
https://stackoverflow.com/questions/42098126/mac-osx-python-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify
Issue with company network:
pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org oauthlib -vvv
@mohapsat
mohapsat / tomcat-7-on-mac
Created January 30, 2019 18:58
Steps to install tomcat 7 on MacOs
https://medium.com/@wkrzywiec/deployment-of-spring-mvc-app-on-a-local-tomcat-server-for-beginners-3dfff9161908
sudo mkdir -p /Library/Tomcat
sudo mv ~/Downloads/apache-tomcat-7.0.92.tar.gz /Library/Tomcat/
sudo gunzip apache-tomcat-7.0.92.tar.gz
sudo tar -xvf apache-tomcat-7.0.92.tar
sudo chmod +x /Library/Tomcat/apache-tomcat-7.0.92/bin/*.sh
sudo ./Library/Tomcat/apache-tomcat-7.0/bin/startup.sh
@mohapsat
mohapsat / SSL_CERTIFICATE_VERIFY_FAILED
Created January 30, 2019 06:02
SSL: CERTIFICATE_VERIFY_FAILED
On MAC OS:
What to do about:
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)
Ref:
https://bugs.python.org/issue29480
@mohapsat
mohapsat / postgres_queries_and_commands.sql
Created January 22, 2019 19:05 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mohapsat
mohapsat / heroku postgres
Created January 18, 2019 23:20
heroku postgres
heroku pg:info --app sfly-promoscraper
=== DATABASE_URL
Plan: Hobby-dev
Status: Available
Connections: 0/20
PG Version: 10.6
Created: 2019-01-16 22:38 UTC
Data Size: 7.6 MB
Tables: 0
Rows: 0/10000 (In compliance)
@mohapsat
mohapsat / how-to-build-a-machine-learning-classifier-in-python-with-scikit-learn
Created January 17, 2019 23:33
how-to-build-a-machine-learning-classifier-in-python-with-scikit-learn
# https://www.digitalocean.com/community/tutorials/how-to-build-a-machine-learning-classifier-in-python-with-scikit-learn
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.metrics import accuracy_score
# Load dataset
data = load_breast_cancer()
@mohapsat
mohapsat / django-admin-manage
Last active August 28, 2018 08:21
Django admin and manage commands
# to make migrations on models are defined
python manage.py makemigrations
# review sql for the migration
python manage.py sqlmigrate <app_name> <migration_number>
e.g. python manage.py sqlmigrate boards 0001
# Django shell to play with the db
python manage.py shell
@mohapsat
mohapsat / instance scenes from array vars
Created August 17, 2018 02:50
[Godot 3] instance scenes from array vars
# Create 2 scenes 0.tscn and 1.tscn
# Add a Node and call it main
# Add script as below to main
extends Node
var scenes = [0,1]
func _ready():
# randomize()
@mohapsat
mohapsat / godot generating_a_scene_tree_dynamically
Created August 16, 2018 17:54
Godot - GraphEdits, GraphNodes, and PopupMenus at runtime
# Ref : https://www.reddit.com/r/godot/comments/7bi5uf/generating_a_scene_tree_dynamically/
# Create a root Node and name is DynamicNodeGraph
extends Node
var RootNode
var SomeGraphEdit
var SomePopupMenu
var SomePopupMenuVisible = false
var RMBPressed = false
@mohapsat
mohapsat / parallax_bg_godot3
Created July 29, 2018 18:46
ParallaxBg_Godot3
To get that ParallaxBackground working:
1. Create a ParallaxBackground node. (It doesn't need to be a child of the Camera2D node, but making it a child of the Camera2D node won't break it either)
2. Create a ParallaxLayer node as a child of the ParallaxBackground.
3. Add your sprite as a child of the ParallaxLayer node and make sure Centered is off.
4. Go back to the ParallaxLayer node.
5. Under Motion, set Mirroring to the size of your sprite (in the case of the Sky sprite, 640x640).
6. Under Motion, fiddle with the Scale setting. This is how fast that ParallaxLayer will move in relation to the camera. I found (0.1, 0.1) to be a good starting point for something like a sky.
7. Run your game, and you should have a background that infinitely loops and also has a parallax effect.