Skip to content

Instantly share code, notes, and snippets.

View somq's full-sized avatar
🎯
Focusing

Clément somq

🎯
Focusing
View GitHub Profile
@bluelovers
bluelovers / ChatGPT Stable Diffusion prompts generator.txt
Last active April 16, 2024 03:22
using ChatGPT as Stable Diffusion prompts generator
Stable Diffusion is an AI art generation model similar to DALLE-2.
Here are some prompts for generating art with Stable Diffusion.
Example:
- A ghostly apparition drifting through a haunted mansion's grand ballroom, illuminated by flickering candlelight. Eerie, ethereal, moody lighting.
- portait of a homer simpson archer shooting arrow at forest monster, front game card, drark, marvel comics, dark, smooth
- pirate, deep focus, fantasy, matte, sharp focus
- red dead redemption 2, cinematic view, epic sky, detailed, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful
- a fantasy style portrait painting of rachel lane / alison brie hybrid in the style of francois boucher oil painting, rpg portrait
@ToastShaman
ToastShaman / Retry.kt
Last active October 18, 2022 21:12
A simple retry mechanism in Kotlin
fun <R> retry(
maxAttempts: Int,
action: () -> R
): R {
require(maxAttempts > 0) { "maxAttempts must be greater than 0" }
return runCatching(action).getOrElse {
val leftAttempts = maxAttempts.dec()
if (leftAttempts == 0) throw it
retry(leftAttempts, action)
}
@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2024 08:55
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@angysmark
angysmark / appsync_client.py
Last active July 23, 2022 17:29
Make a GraphQL Appsync client in Python
import json
import os
from boto3 import Session as AWSSession
from requests_aws4auth import AWS4Auth
from gql import gql
from gql.client import Client
from gql.transport.requests import RequestsHTTPTransport
@mwufi
mwufi / install_docker_in_colab.sh
Last active May 7, 2024 14:00
Install Docker in Google Colab!
# First let's update all the packages to the latest ones with the following command
sudo apt update -qq
# Now we want to install some prerequisite packages which will let us use HTTPS over apt
sudo apt install apt-transport-https ca-certificates curl software-properties-common -qq
# After that we will add the GPG key for the official Docker repository to the system
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# We will add the Docker repository to our APT sources
@Juice805
Juice805 / playstv_videos_downloader.py
Last active December 7, 2019 23:29 — forked from st0le/PlaysTvDownloader.ps1
Downloads all public videos of a user
#! /usr/bin/python3
# download all PlaysTv videos of a user
# To find the user id, navigate to the your profile while logged in (IMPORTANT!)
# View source of the page, In the <html> tag there's data-conf attribute.
# The json in there will have the user id under [login_user.id]
user_id = "<playstv user guid>"
# Replace the <playstv user guid> above with your ID
@dalezak
dalezak / README.md
Last active September 11, 2023 09:51
Ionic Capacitor Resources Generator
  1. Run npm install cordova-res --save-dev
  2. Create 1024x1024px icon at resources/icon.png
  3. Create 2732x2732px splash at resources/splash.png
  4. Add "resources": "cordova-res ios && cordova-res android && node scripts/resources.js" to scripts in package.json
  5. Copy resources.js file to scripts/resources.js
  6. Run sudo chmod -R 777 scripts/resources.js
  7. Run npm run resources
@PasanBhanu
PasanBhanu / CheckNetwork.java
Last active July 25, 2023 13:28
Check Internet Connection in Android (API Level 29) Using Network Callback
/*
You need to call the below method once. It register the callback and fire it when there is a change in network state.
Here I used a Global Static Variable, So I can use it to access the network state in anyware of the application.
*/
// You need to pass the context when creating the class
public CheckNetwork(Context context) {
this.context = context;
}
@inertia186
inertia186 / .description.tintoy.txt
Last active December 4, 2021 01:31
Tin Toy - A tiny Hive testnet based on tinman
Tin Toy for Hive. Please have a look at the README.md file or check it out on Docker Hub: https://hub.docker.com/r/inertia/tintoy/