Skip to content

Instantly share code, notes, and snippets.

View leynier's full-sized avatar
💻

Leynier Gutiérrez González leynier

💻
View GitHub Profile
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
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 / 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)
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
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):
@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)
]
#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
const long long int inf = 1LL << 60;
long long int c_decrement[maxn], c_increment[maxn], dist[maxn];
vector<pair<long long int, long long int>> decrement[maxn], increment[maxn];
void dijkstra() {
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
long long ret, fact[100005], inv[100005];
int n, m, i, j, odd, sum, kk[10];
char a[100005];
struct node {
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
int mn = 0;
vector<int> list;
for (int i = 0; i < n; ++i) {
#include <bits/stdc++.h>
using namespace std;
const int maxn = 300;
const int mod = int(1e9) + 7;
const long long inf = numeric_limits<long long>::max();
class OverflowInteger {
public: