Skip to content

Instantly share code, notes, and snippets.

View ILoveBacteria's full-sized avatar

Moein Arabi ILoveBacteria

View GitHub Profile
@ILoveBacteria
ILoveBacteria / yt-dlp.md
Last active August 31, 2024 06:08
The most useful flags for yt-dlp

USAGE AND OPTIONS

General Options

--flat-playlist                 Do not extract the videos of a playlist,
                                only list them

--live-from-start               Download livestreams from the start.
                                Currently only supported for YouTube
@ILoveBacteria
ILoveBacteria / docker-compose.yml
Created August 23, 2024 18:47
Setup Mtproto Telegram proxy
# docker-compose.yml
services:
mtproto-proxy:
image: telegrammessenger/proxy
container_name: mtproto-proxy
restart: always
ports:
- "10000:443"
volumes:
@ILoveBacteria
ILoveBacteria / docker-compose.yml
Created May 20, 2024 17:31
How to run the mtproto-proxy image and create a systemd unit.
version: "3.9"
services:
mtproto:
container_name: mtproto-proxy
image: seriyps/mtproto-proxy:latest
ports:
- "10000:10000"
env_file:
- ./.env
@ILoveBacteria
ILoveBacteria / 1-react-tailwindcss-webpack.md
Last active July 15, 2023 19:09
How to pack a React app and Tailwindcss with Webpack

React-Tailwindcss-Webpack Setup

Github Gist stars GitHub Gist last commit

In this tutorial we will precompile jsx codes with babel and then pack the entire app that includes tailwindcss and React with webpack. At last we have app.js bundle file that contains all javascript source codes, dependencies and tailwindcss.

Table of Contents

@ILoveBacteria
ILoveBacteria / client.dart
Created June 29, 2023 15:05
Request and response through socket in Dart and Java
import 'dart:convert';
import 'dart:core';
import 'dart:io';
class MySocket {
final int port = 5000;
final String host = "10.0.2.2";
final String data;
MySocket(this.data);
@ILoveBacteria
ILoveBacteria / request.js
Last active March 10, 2023 19:33
How to send a get request in JavaScript
async function getData(url) {
const headers = {} // Add headers here
const init = {
method: 'GET',
headers: new Headers(headers),
}
const response = await fetch(url, init);
if (response.ok) {
return await response.json();
}
@ILoveBacteria
ILoveBacteria / App.js
Last active March 8, 2023 14:36
How to handle events correctly in React
class App extends React.Component {
constructor(props) {
super(props);
this.chooseVideo = this.chooseVideo.bind(this);
}
chooseVideo(newVideo) {
this.setState({
// Change something
});
@ILoveBacteria
ILoveBacteria / forms.py
Last active March 8, 2023 14:25
A simple form in Django
from django import forms
class NameForm(forms.Form):
your_name = forms.CharField(label='Your name', max_length=100)
@ILoveBacteria
ILoveBacteria / polls_templates_polls_detail.html
Last active March 8, 2023 14:26
How to write a minimal form in Django
<!-- polls/templates/polls/detail.html -->
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
<fieldset>
<legend><h1>{{ question.question_text }}</h1></legend>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
{% for choice in question.choice_set.all %}
<input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}">
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br>
{% endfor %}
@ILoveBacteria
ILoveBacteria / mysite_urls.py
Created March 4, 2023 20:05
Create paths in Django
# mysite/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('polls/', include('polls.urls')),
path('admin/', admin.site.urls),
]