Skip to content

Instantly share code, notes, and snippets.

@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active July 3, 2024 20:33
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@oliviagardiner
oliviagardiner / component.vue
Last active February 1, 2021 01:03
Nuxt.js + vue-moment
// components/component.vue
<template lang="pug">
div {{ new Date() | moment("dddd, MMMM Do YYYY, h:mm:ss a") }}
b-form-select(:value="locale" @change="changeLocale($event)")
option(v-for="lang in locales" :value="lang" :key="lang")
i(:class="'flag-icon-' + lang").flag-icon
</template>
<script>

Recientemente StarUML se actualizó de 2.0 a 3.0. El método de crack original, la forma de modificar la función de verificación de licencia no se puede usar. La ubicación de instalación ha cambiado y se ha encontrado el archivo LicenseManagerDomain.js. ¿Qué debería hacer? El viejo conductor les dijo a todos que resolvieran el problema.

StarUML está escrito en nodejs. Específicamente, está escrito en el marco frontal de Electron. Todo el código fuente de starUML en la nueva versión viene empaquetado por la herramienta asar.

Ingresar al directorio (Windows)

C:\Program Files\StarUML\resources

@hellt
hellt / wait_for_ssh.py
Last active September 18, 2023 08:21
wait_for_ssh function continuously checks whether SSH transport is ready
import paramiko
import time
def wait_for_ssh_to_be_ready(host, port, timeout, retry_interval):
client = paramiko.client.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
retry_interval = float(retry_interval)
timeout = int(timeout)
timeout_start = time.time()
@yzhong52
yzhong52 / gist:f81e929e5810271292bd08856e2f4512
Last active June 18, 2022 13:53
Create Spark DataFrame From List[Any]
// Spark 2.1
val spark = SparkSession.builder().master("local").getOrCreate()
// Given a list of mixture of strings in integers
val values = List("20030100013280", 1.0)
// Create `Row` from `Seq`
val row = Row.fromSeq(values)
// Create `RDD` from `Row`
@vlucas
vlucas / encryption.js
Last active July 11, 2024 22:13
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
<html>
<head>
<title>API Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var accessToken = "<your agent's client access token>";
var baseUrl = "https://api.api.ai/v1/";
@takahashilabo
takahashilabo / drawArrow.pde
Last active December 27, 2017 13:23
draw an arrow method for Processing
void setup() {
size(400, 400);
stroke(255);
noLoop();
}
void draw() {
background(255);
stroke(255, 0, 0);
fill(255, 0, 0);
@henriquemenezes
henriquemenezes / postgresql-set-id-seq.sql
Created March 31, 2016 12:23
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
@peteroupc
peteroupc / LineReader.js
Last active November 22, 2022 04:05
JavaScript class for reading files line by line in HTML5 apps
/*
Written by Peter O.
Any copyright to this work is released to the Public Domain.
In case this is not possible, this work is also
licensed under Creative Commons Zero (CC0):
https://creativecommons.org/publicdomain/zero/1.0/
*/