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
| #include "tris.h" | |
| int main() { | |
| printf("New game - you are X\n"); | |
| char *stati[4] = {"Running", "Draw", "X Wins", "O Wins"}; | |
| Game *game = NULL; | |
| if(new_game(&game) > -1) { | |
| while(1) { | |
| int row, col = 0; | |
| printf("Your move (row,col): "); |
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
| # Utilizzo: ./gaiola.sh DATA TURNO | |
| # Data: formato DD/MM (es. 28/01) | |
| # Turno: 1 (mattina), 2 (pomeriggio) | |
| year=$(date +"%Y") | |
| fixed_date=$(echo $1 | awk -F'/' '{print $2"-"$1}') | |
| date="$year-$fixed_date" | |
| turno=$2 |
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
| vqd="" | |
| current_payload="" | |
| send_chat_message() { | |
| out=$(curl -s -v -X POST 'https://duckduckgo.com/duckchat/v1/chat' -H "Cookie: dcm=3; dcs=1" -H "Referer: https://duckduckgo.com/" -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" -H "x-vqd-4: $vqd" -H 'Content-Type: application/json' -d "$current_payload" 2>&1) | |
| req_body=$(echo "$out" | awk 'BEGIN{a=0;b=0;}{if($1=="<"){a=1;} if(a==1&&$1=="{"){b=1;} if(b>0){b+=1;} if(b>3){print $0}}') | |
| if [[ ! "$req_body" =~ \{\"action\":\"error\" ]]; then | |
| msg="" | |
| append="" |
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, json | |
| ''' | |
| API Exception class | |
| ''' | |
| class APIException(Exception): | |
| def __init__(self, status, _type): | |
| super().__init__(f'[{status}] {_type}') | |
| self.status = status | |
| self.type = _type |