val calendarWeek = 3 val calendarWeekString = calendarWeek.toString().padStart(2, '0')
Good Reads – Gute Bücher
Die Gesetze der Gewinner: Erfolg und ein erfülltes Leben – Bodo Schäfer
Die 4-Stunden-Woche: Mehr Zeit, mehr Geld, mehr Leben – Tim Ferriss
Ich zeige Dir wie Du reich wirst: Das einzigartige 6-Wochen-Programm, das wirklich funktioniert – Ramit Sethi
Bullet Journal Method
Atomic Habits
Clean Personal Finance
The Grades
I’ve stolen this concept from the Clean Code Developer initiative.
https://clean-code-developer.com/grades/
The main idea is that you don’t try every financial advice all at once but organize it into different stages from easy to hard. Continue reading “Clean Personal Finance”
Curated List of Management Literature
Sound and music with pygame
pip install pygame
Sound
import pygame if __name__ == '__main__': pygame.mixer.init() sound = pygame.mixer.Sound("./sound.wav") channel = sound.play() while channel.get_busy(): pygame.time.wait(100) print("Playing...") print("Finished.")
Music
import pygame if __name__ == '__main__': pygame.mixer.init() pygame.mixer.music.load("./sound.mp3") pygame.mixer.music.play() while pygame.mixer.music.get_busy(): pygame.time.wait(100) # ms print("Playing...") print("Finished.")
Getting Location Info in Android
Manifest
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Activity
public static final int REQUEST_CODE = 123; LocationManager mLocationManager; LocationListener mLocationListener;
@Override protected void onResume(){ super.onResume(); getCurrentLocation(); }
private void getCurrentLocation() { Log.d("Clima", "getWeatherForCurrentLocation"); mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); mLocationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { Log.d("Clima", "onLocationChanged"); String longitude = String.valueOf(location.getLongitude()); String latitude = String.valueOf(location.getLatitude()); Log.d("Clima", "longitude is: " +longitude); Log.d("Clima","latitude is: " + latitude); } @Override public void onStatusChanged(String s, int i, Bundle bundle) { } @Override public void onProviderEnabled(String s) { } @Override public void onProviderDisabled(String s) { } }; if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CODE); return; } mLocationManager.requestLocationUpdates(LOCAION_PROVIDER, MIN_TIME, MIN_DISTANCE, mLocationListener); }
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); Log.d("Clima", "onRequestPermissionsResult"); if (requestCode == REQUEST_CODE) { if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){ getCurrentLocation(); } } }
Passing data between AndroidActivities
Sending data
private void openVideoActivity(String video) { Intent newActivity = new Intent(this, PlayerActivity.class); newActivity.putExtra("videoId", video); startActivity(newActivity); }
Retrieving data
final String videoID = getIntent().getExtras().getString("videoID");
Python variable length arguments
def print_person_varargs(name, *vargs): print(name) print(vargs) for arg in vargs: print(arg) def print_person_kwargs(name, **kwargs): print(name) print(kwargs) for i, j in kwargs.items(): print(i, j) print_person_varargs("Jörn", 38, "Emskirchen") print_person_kwargs("Jörn", age=38, city="Emskirchen")
Introduction to the Julia programming language
Installation
You can download the installer at https://julialang.org/
On Windows you have to set the path manually, e.g. C:\Julia-1.3.1\bin
Let’s fire up a command line and type: julia
You will be greeted with a nice little ascii art and the prompt.
If You want to close the prompt You can use CTRL + D Continue reading “Introduction to the Julia programming language”
Android Services
Service Manager
$ adb shell service list
shell@g3:/ $ service list Found 132 services: 0 AtCmdFwd: [com.qualcomm.atfwd.IAtCmdFwd] 1 lge.apdu: [com.lge.smartcard.internal.apdu.uicc.IUiccAccess] 2 telecom: [com.android.internal.telecom.ITelecomService] 3 phone: [com.android.internal.telephony.ITelephony]