Skip to content

Instantly share code, notes, and snippets.

View leflon's full-sized avatar
🌑

Paul Leflon leflon

🌑
View GitHub Profile
@leflon
leflon / cmd.py
Created November 6, 2024 09:52
I learned about the /attributes command recently. I've always been a fan of the Passengers NBT tag, so I decided to make this script to have fun more easily with these two.
# Messing around with mobs.
sizes = [i/10 for i in range(1, 10)] + [i for i in range(1, 32, 1)]
def rec(n):
if n == 0:
return '{"id":"villager"}'
return '{"id":"villager",attributes:[{"id":"scale","base":' + str(sizes[len(sizes) - n - 1]) + '}],Passengers:[' + rec(n-1) + ']}'
cmd = "/summon minecraft:villager ~1 ~1 ~ {attributes:[{\"id\":\"scale\",base:0.1}],Passengers:[" + rec(len(sizes) - 1) + "]}"
@leflon
leflon / sketch.js
Created May 30, 2021 16:13
Simulation de rebondissement approximative - p5js
/// Constantes
// Nombre de frames par seconde
const rate = 60;
// Intensité de pesanteur (px/s);
const g = 10;
// Coefficient de restitution
@leflon
leflon / main.md
Last active March 21, 2021 23:29
Use a Twitter Application on a different account (for dummies)

Use a Twitter Application on a different account for dummies

While making a new Twitter bot (@LesGossesBot, 🇫🇷 une dinguerie), I thought the bot account needed to be a developer account to run applications. Spoiler: it doesn't!

In this Gist I'll show you how easily you can run applications from your developer account on any other account you own, using twurl! It's not so hard to follow the documentation, but I was maybe too idiot and struggled with it at first.

Overview

When using the Twitter API, you must provide consumer_key, consumer_secret, access_token, access_token_secret to authenticate. The consumer keys belong to the application. They are the identity of you Twitter App, nothing else. Though, the access tokens belong to the user. They are what authorizes your application to tweet from a user account.

@leflon
leflon / conditions_boucles_2.py
Last active October 10, 2020 09:04
Yet other school python exercises about loops and conditions
# Exercice 1
def minimum(a,b,c):
_min=a
if (b<_min): _min = b
if (c<_min): _min = c
return _min
# Exercice 2
prix_enfant = 5.60
@leflon
leflon / conditions_boucles_1.py
Last active October 10, 2020 09:04
Just some school Python exercises about loops and conditions
from functools import reduce
# Exercice 4
# 1.
def somme_impairs(n):
s = 0
for i in range(1, n+1, 2):
s += i
@leflon
leflon / owo.css
Last active December 2, 2018 14:18
OwO smiley generator
html, body {
width: 100%;
height: 100%;
margin: 0;
background: #111;
color: #FEFEFE;
}
body {
display: flex;
flex-direction: column;