Skip to content

Instantly share code, notes, and snippets.

View David-Lor's full-sized avatar
🐍
entro.py

David Lorenzo David-Lor

🐍
entro.py
  • Vigo/Galiza/Spain
  • 01:20 (UTC +02:00)
View GitHub Profile
@David-Lor
David-Lor / CrearDiscoVirtualExt4Dropbox.md
Created November 7, 2018 10:46
Crear disco duro virtual EXT4 para Dropbox

Crear disco virtual ext4 para Dropbox

Dado que ahora Dropbox no puede sincronizarse en sistemas de archivos no compatibles (y esto incluye carpetas /home de Ubuntu y otras distros encriptadas), se puede crear un disco duro virtual donde sincronizar Dropbox (de tamaño fijo, no variable!).

http://www.linuxandubuntu.com/home/creating-virtual-disks-using-linux-command-line

1.-Crear archivo vacío que usaremos para el disco virtual

(count: tamaño de disco en MB)

@David-Lor
David-Lor / Mount.bat
Created October 28, 2018 07:35
Mount several Virtual Hard Disks in Windows programmatically
python "F:\Juegos\DiscosVirtuales\Montar.py"
@David-Lor
David-Lor / InstalarCronicleConda.md
Created October 3, 2018 18:53
Instalar Cronicle en virtualenv Conda
@David-Lor
David-Lor / paratroopers.cs
Created June 29, 2018 13:59
gta v paratroopers wip
using GTA;
using GTA.Native;
using GTA.Math;
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
public class paracas : Script
{
@David-Lor
David-Lor / python_frases_diccionario.py
Created May 16, 2018 12:55
python frases diccionario
def contiene_hola():
print("el texto contiene 'hola'")
def contiene_que_tal():
print("el texto contiene 'que tal'")
def contiene_hasta_luego():
print("el texto contiene 'hasta luego'")
diccionario = {
@David-Lor
David-Lor / FreemodeMPCops.cs
Created May 3, 2018 19:02
GTA V Freemode MP Cops WIP
using GTA;
using GTA.Native;
using System;
using System.Windows.Forms;
using System.Collections.Generic;
public class FreemodeMP_Cops : Script
{
private int relationship_player=0, relationship_cop_wanted=0, relationship_cop_unwanted=0, prevWantedlevel = 0;
private List<Ped> cops = new List<Ped>();
@David-Lor
David-Lor / ACPowerAutoGovernor.sh
Created April 18, 2018 08:43
Set CPU governor depending on charge status of the laptop
#!/bin/bash
GOVERNOR_AC=performance # CPU governor when charging
GOVERNOR_DC=powersave # CPU governor when not charging
LOOP_FREQ=5 # Delay on AC status checking
function getAC { # Returns AC status (1=charging, 0=discharging)
echo $(cat /sys/class/power_supply/AC0/online)
}
@David-Lor
David-Lor / disablewupdateWatchdog.bat
Created March 7, 2018 17:50
Disable Windows Update "Watchdog"
@echo off
:loop
sc stop "wuauserv"
sc config "wuauserv" start= disabled
timeout 15
goto loop
@David-Lor
David-Lor / enable_i2c_openwrt_rpi1.md
Last active June 1, 2023 13:28
Enable I2C support on OpenWRT/LEDE @ Raspberry Pi (1 model B)

Enable I2C on OpenWRT/LEDE @ Raspberry Pi (1 model B)

/boot/config.txt

Edit this file on any computer, insert the SD card and create/enter the boot folder located at the FAT32 partition (it's very small, ~20MB).

Contents of the config.txt file:

@David-Lor
David-Lor / telebot_polling_template.py
Last active October 7, 2024 10:26
pyTelegramBotAPI - Never ending bot polling (recovery in failure)
"""
This is how I run my new bots created with pyTelegramBotAPI to avoid API errors,
like timeout errors or whenever my server can't reach Telegram servers (i.e. if net is down).
A while loop restarts the polling when it's ended due to an error.
A new bot object is created in each new loop execution, to avoid some errors.
We set all our message handlers in botactions() so the new bot object can use them.
Threading is not needed, but I prefer running the while True loop threaded so I can stop the bot
anytime with Ctrl+C, otherwise it can't be stopped easily. Killing the script is not nice and
I use databases in some bots, which should be closed beforehand.