Skip to content

Instantly share code, notes, and snippets.

@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active April 24, 2024 17:00
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.
@maratori
maratori / .golangci.yml
Last active April 24, 2024 16:59
Golden config for golangci-lint
# This code is licensed under the terms of the MIT license https://opensource.org/license/mit
# Copyright (c) 2021 Marat Reymers
## Golden config for golangci-lint v1.57.2
#
# This is the best config for golangci-lint based on my experience and opinion.
# It is very strict, but not extremely strict.
# Feel free to adapt and change it for your needs.
run:
@kcranston
kcranston / postgres-jsonb.md
Last active April 24, 2024 16:59
intro to document stores in postgreSQL

Document stores in PostgreSQL

Notes for software engineering meeting presentation

What

  • mid to late 2000s: appearance of Document stores / NoSQL databases such as Mongo, Couch
  • Relational DBs now have support for document data: JSON in MySQL, JSON and JSONB in PostgreSQL
  • Focus on JSONB in Postgres (most full featured)
@fagnercarvalho
fagnercarvalho / commands.sh
Created October 10, 2020 20:48
Install bluealsa and pair/connect to Bluetooth device in Linux
# Install bluealsa to create interface to Bluetooth device
git clone https://github.com/Arkq/bluez-alsa.git
cd bluez-alsa
su
apt-get install libglib2.0-dev -y
apt-get install -y libasound2-dev
apt install -y build-essential autoconf
apt-get install -y libbluetooth-dev
apt-get install libtool -y
@mortn
mortn / geoblocker
Last active April 24, 2024 16:55
nginx geoip blocking with network exceptions.
# /etc/nginx/geoblocker
# This will block anything but the defined countries and the networks defined in the $localnet variable
set $geoblock 0;
if ($geoip_country_code !~ (DK|NO|SE)) { set $geoblock 1; }
if ($localnet = 1){ set $geoblock 0; }
if ($geoblock = 1){ return 403; }
from langchain.chat_models import ChatOpenAI
from langchain.prompts import ChatPromptTemplate
from langchain.schema.output_parser import StrOutputParser
import requests
from bs4 import BeautifulSoup
from langchain.schema.runnable import RunnablePassthrough, RunnableLambda
from langchain.utilities import DuckDuckGoSearchAPIWrapper
import json
RESULTS_PER_QUESTION = 3
@Mearman
Mearman / Obsidian Snippets
Last active April 24, 2024 16:52
Obsidian Snippets
A collection of snippets
@zackpyle
zackpyle / fluent-forms-dynamic-submit-button-text.php
Created April 24, 2024 14:28
Fluent Forms - Use shortcode attr and FF SmartCode to pass dynamic Submit Button text
<?php
// Register Fluent Forms SmartCode
add_filter('fluentform/editor_shortcodes', function ($smartCodes) {
$smartCodes[0]['shortcodes']['{submit_button_text}'] = 'Dynamic Submit Button Text';
return $smartCodes;
});
// Use text from submit_button_text attribute on the form's shortcode
add_filter('fluentform/editor_shortcode_callback_submit_button_text', function ($value, $form) {
@0xdevalias
0xdevalias / _deobfuscating-unminifying-obfuscated-web-app-code.md
Last active April 24, 2024 16:51
Some notes and tools for reverse engineering / deobfuscating / unminifying obfuscated web app code
@deanhume
deanhume / clear-cache.js
Created September 20, 2017 08:22
Clear Service Worker Cache
if ('serviceWorker' in navigator) {
caches.keys().then(function(cacheNames) {
cacheNames.forEach(function(cacheName) {
caches.delete(cacheName);
});
});
}