Skip to content

Instantly share code, notes, and snippets.

View bluemyria's full-sized avatar
❤️
React

bluemyria bluemyria

❤️
React
  • blum.systems
  • Munich, Germany
View GitHub Profile
@bluemyria
bluemyria / GCP_Console.sh
Last active May 16, 2023 15:14
CGP Dev 5. Developing a Backend Service - Python
# Create a Cloud Pub/Sub topic
# In the Cloud Platform Console, click Navigation menu > Pub/Sub > Topics.
# Create a topic., eg "feedback"
gcloud pubsub subscriptions create worker-subscription --topic feedback
#Publish a message to a Cloud Pub/Sub topic
gcloud pubsub topics publish feedback --message "Hello World"
#Retrieve a message from a Cloud Pub/Sub subscription
@bluemyria
bluemyria / Java2Dart_imperative_code.dart
Last active October 2, 2019 12:04
Dart / Flutter myNotes
String scream(int length) => "A${'a' * length}h!";
main() {
final values = [1, 2, 3, 5, 10, 50];
for (var length in values) {
print(scream(length));
}
// OR
values.map(scream).forEach(print);
@bluemyria
bluemyria / 1_GCP_Console.sh
Last active May 16, 2023 15:15
CGP Dev 4. Adding User Authentication - Python
git clone https://github.com/GoogleCloudPlatform/training-data-analyst
cd ~/training-data-analyst/courses/developingapps/python/firebase/start
. prepare_environment.sh
python run_server.py
# Web preview > Preview on port 8080 to preview the Quiz application.
# Note Cloud Shell Web preview domain (in form: 8080-dot-2958229-dot-devshell.appspot.com)
# Create a Firebase project
# Develop > Authentication > Set up sign-in method > Email/Password > Enable
# Under Authorized Domains > Add Domain (in form: 8080-dot-2958229-dot-devshell.appspot.com)
@bluemyria
bluemyria / 1_quiz_gcp_storage.py
Last active May 16, 2023 15:15
CGP Dev 3. Storing Image/Video Files in Cloud Storage - Python
# Get the Bucket name from the GCLOUD_BUCKET environment variable
bucket_name = os.getenv('GCLOUD_BUCKET')
# Import the storage module
from google.cloud import storage
# Create a client for Cloud Storage
storage_client = storage.Client()
# Use the client to get the Cloud Storage bucket
@bluemyria
bluemyria / 1_quiz_gcp_datastore.py
Last active May 16, 2023 15:15
GCP Dev: 2. Storing Application Data in Cloud Datastore - Python
# Import the os module
import os
# Use the os module to get the GCLOUD_PROJECT environment variable
project_id = os.getenv('GCLOUD_PROJECT')
from flask import current_app
# Import the datastore module from the google.cloud package.
from google.cloud import datastore
@bluemyria
bluemyria / GCP_Console.sh
Last active May 16, 2023 15:16
GCP Dev: 1. DevEnv - Python
# Navigation menu => Compute Engine => VM Instances => Create
# Identity and API access => Allow full access to all Cloud APIs.
# Firewall => Allow HTTP traffic
# SSH
sudo apt-get update
sudo apt-get install git
sudo apt-get install python-setuptools python-dev build-essential
sudo easy_install pip
@bluemyria
bluemyria / android.019.java
Created March 19, 2018 10:58
Android - 019 - ContextMenu
public class MainActivity extends AppCompatActivity {
private TextView tv;
private Button btn;
private CheckBox cb;
private MenuItem miBtnMenuitem1;
private MenuItem miBtnMenuitem2;
private MenuItem miTvMenuitem1;
@bluemyria
bluemyria / android.018.java
Last active March 19, 2018 10:41
Android - 018 - App-Einstellungen
//////////////////////////////////////////////////////////////////////////////////////////////
// in der Main Activity
//////////////////////////////////////////////////////////////////////////////////////////////
public class MainActivity extends AppCompatActivity
{
private Button btnPrefs, btnPrefsAnzeigen;
private TextView tv;
/**
* Die SharedPreferences speichern Benutzereinstellungen und lassen
@bluemyria
bluemyria / android.017.java
Last active March 19, 2018 10:06
Android - 017 - Animations
//////////////////////////////////////////////////////////////////////////////////////////////
// in der Activity
//////////////////////////////////////////////////////////////////////////////////////////////
public class MainActivity extends AppCompatActivity {
private Button btn;
private ImageView bild;
private Animation animEinklappen, animAusklappen;
@bluemyria
bluemyria / android.016.java
Last active March 12, 2018 12:39
Android - 016 - Implicit Intents
//////////////////////////////////////////////////////////////////////////////////////////////
// in AndroidManifest.xml
//////////////////////////////////////////////////////////////////////////////////////////////
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=".......w3t1_impliziteintents_mariab">
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />