Skip to content

Instantly share code, notes, and snippets.

View david-fairbanks42's full-sized avatar

David Fairbanks david-fairbanks42

View GitHub Profile
@david-fairbanks42
david-fairbanks42 / delete-empty-keyring-entries.py
Created January 31, 2022 16:27
Clean up empty keyring entries
# Linux keyring file (login.keyring) contained a lot of dead entries with black passwords
# Update the application siganture (chrome-6391234) from an entry
# Additional/Alternative search items could be added
import keyring
keys = keyring.get_keyring()
for k in keys.backends:
if isinstance(k, keyring.backends.SecretService.Keyring):
collection = k.get_preferred_collection()
@david-fairbanks42
david-fairbanks42 / observable-expand.ts
Created April 10, 2018 22:52
This is an example of Rx Observable expand method usage. The idea here is to divide large requests into paged results, then combine the results on the front end. This example will continue to request chunks of data from the backend until it receives a response that says there is no more results to get.
export class ProductService {
constructor(private authHttp: AuthHttp) {}
get(): Observable<any> {
this.products = [];
return this.authHttp.get('/api/products', {search: {limit: 100}})
// Take information from first response and make subsequent responses
// Response body contains: {hasMore: (boolean), nextOffset: (int), data: (array)}
.expand((response) => {
let obj = response.json();