Skip to content

Instantly share code, notes, and snippets.

View leynier's full-sized avatar
👨‍💻

Leynier Gutiérrez González leynier

👨‍💻
View GitHub Profile
@leynier
leynier / solve.py
Created October 25, 2020 21:00
Pseudo code of solve of Hidato
def solve(table, step, limit):
if step == limit + 1:
return [table]
else:
return [
item
for new_table in step_matrix(table, step)
for item in solve(new_table, step + 1, limit)
]
def generate(n_rows, n_cols, ratio, diff):
hidato_solved = generate_hidato_solved(n_rows, n_cols, ratio)
max_elem = n_rows * n_cols - count_obstacles(hidato_solved)
cells_for_remove = random_shuffle(filter(lambda cell: get_cell_value(cell) > 1 and get_cell_value(cell) < max_elem, get_cells(hidato_solved)))
cant_empty = floor(len(cells_for_remove) * diff)
template = remove_cells(hidato_solved, n_rows, n_cols, cells_for_remove, cant_empty)
return template
def generate_hidato_solved(n_rows, n_cols, ratio):
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf
@leynier
leynier / README.md
Created June 19, 2022 09:11
restore missing mobile data in quick settings

Restore missing mobile data in quick settings

  • Activate Developer options in phone
  • Activate USB debugging inside Developer options
  • Connect phone by USB to PC and allow that PC can debugging
  • Download Android SDK
  • Go to platform-tools inside of Android SDK downloaded
  • Execute adb devices and ensure that mobile appear in the list
  • Execute adb shell
  • Execute settings get secure sysui_qs_tiles and copy the output (will be reference to the content copied as YOUROLDLIST)
@leynier
leynier / main.dart
Last active November 22, 2022 06:25
intersection-point
void main() {
final p1 = Point(0, 0);
final p2 = Point(-5, -10);
final p3 = Point(-10, -5);
final p4 = Point(15, -5);
final r1 = Line(p1, p2);
final r2 = Line(p3, p4);
final pi = intersection(r1, r2);
print("${pi.x}, ${pi.y}");
}
@leynier
leynier / main.dart
Created November 22, 2022 03:49
jade-pomelo-4826
void main() {
final p1 = Point(0, 0);
final p2 = Point(-5, -10);
final p3 = Point(-10, -5);
final p4 = Point(15, -5);
final r1 = Line(p1, p2);
final r2 = Line(p3, p4);
final pi = intersection(r1, r2);
print("${pi.x}, ${pi.y}");
}