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
| # --- Ghostty Configuration 1.2.3 --- | |
| # Theme & Appearance | |
| theme = niji | |
| background-opacity = 0.88 | |
| window-colorspace = display-p3 | |
| macos-titlebar-style = hidden | |
| # Optional: makes the padding look uniform on all sides | |
| window-padding-balance = true |
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 fs from 'node:fs'; | |
| import axios, { AxiosError } from 'axios'; | |
| import formData from 'form-data'; | |
| type ImgHippoResponse = { data: { view_url: string } }; | |
| /** | |
| * Uploads an image to ImgHippo and returns the URL of the uploaded image. | |
| * @example await uploadImage('path/to/image.png'); // https://i.imghippo.com/files/VGcQE1720193383.png | |
| * @param imagePath the path to the image to upload |
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 axios, { AxiosError } from 'axios'; | |
| import fs from 'fs'; | |
| import formData from 'form-data'; | |
| const imageUploaderKeyEnvVar = process.env['IMG_UPLOADER_KEY']; | |
| export class ImageUploader { | |
| static async upload(imagePath: string): Promise<string> { | |
| const form = new formData(); | |
| const image = fs.readFileSync(imagePath, { encoding: 'base64' }).toString(); |
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
| def assert_valid_value(value) | |
| unless value.blank? || mapping.has_key?(value) || mapping.has_value?(value) | |
| raise ArgumentError, "'#{value}' is not a valid #{name}" | |
| end | |
| end | |
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
| require("dotenv").config(); | |
| const redis = require("redis"); | |
| const { REDIS_URL } = process.env; | |
| (async () => { | |
| // connect to Redis | |
| let redisClient; | |
| if (REDIS_URL) { | |
| redisClient = redis.createClient(REDIS_URL); |
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
| const Sequelize = require("sequelize"); | |
| module.exports = new Sequelize({ | |
| database: "test", | |
| username: "root", | |
| password: "mysecretpassword", | |
| dialect: "postgres", | |
| }); |
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
| package main | |
| import ( | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "regexp" | |
| "github.com/disintegration/imaging" | |
| ) |
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 <iostream> | |
| #include "exercise.hpp" | |
| #define endl '\n' | |
| using namespace std; | |
| int print_usage() | |
| { | |
| cout << "./create-exercise " << endl; | |
| cout << "./create-exercise [exercise_number]'" << endl; |
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 <bits/stdc++.h> | |
| using namespace std; | |
| int main() { | |
| int n; | |
| cin >> n; | |
| int answer = n; /// assume we used all of coin1 | |
| for (int c4 = 0; c4 <= n / 4; c4++) { // try to take c4 of coin4 | |
| for (int c3 = 0; c3 <= (n - 4 * c4) / 3; c3++) { // try to take c3 of coin3 | |
| int c1 = n - (4 * c4 + 3 * c3); |
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 <stdio.h> | |
| int main () { | |
| long long n, m; | |
| scanf("%lld %lld", &n, &m); | |
| const long long MOD = 17e7; // same as 17x10^7 | |
| long long ans = m; | |
| // or ans = 1 and for(int i = 0; i < n; i++) | |
NewerOlder