Skip to content

Instantly share code, notes, and snippets.

const API_URL = "https://api.openai.com/v1/chat/completions";
const MAX_TOKENS = 1500;
const TEMPERATURE = 0.5;
const SYSTEM_PROMPT = 'Act as assistant';
const MESSAGES = ["hello", "hi!", "how are you?"];
async function openAICompletion(msg) {
const options = {
method: "POST",
headers: {
@intrd
intrd / easy_java_update.txt
Last active September 14, 2020 23:52
Easy java install & update
wget http://ns1.iranns.ir/jdk-13.0.2_linux-x64_bin.tar.gz
git clone https://github.com/chrishantha/install-java
cd install-java
sudo ../install-java.sh -f jdk-13.0.2_linux-x64_bin.tar.gz
@mardr
mardr / mbank_unlifting.user.js
Last active April 15, 2019 18:25
Przywraca wygląd strony transakcyjnej mbanku z przed liftingu. Do działania wymaga jednego z rozszerzeń do przeglądarki: np. Greasemonkey lub Tampermonkey.
// ==UserScript==
// @name mbank unlifting
// @description Przywraca wygląd strony transakcyjnej mbanku z przed liftingu
// @version 0.1
// @grant none
// @author mardr
// @include https://online.mbank.pl/*
// ==/UserScript==
document.documentElement.classList.remove('lifting');
@cvan
cvan / webgl-detect-gpu.js
Last active January 19, 2024 02:54
use JavaScript to detect GPU used from within your browser
var canvas = document.createElement('canvas');
var gl;
var debugInfo;
var vendor;
var renderer;
try {
gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
} catch (e) {
}
@intrd
intrd / tutorial_kali_autologin_afterupdate.txt
Last active January 28, 2024 06:32
Kali light xfce4 root autologin (works after lightdm update)
## Kali light xfce4 root autologin (works after lightdm update)
# @author intrd - http://dann.com.br/
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
Root autologin is broken after lighdtdm update, fix by doing this:
nano /etc/lightdm/lightdm.conf
at [Seat:*] group uncomment/edit:
autologin-user=root
autologin-user-timeout=0
@simonw
simonw / wget.md
Created December 9, 2016 06:38
Recursive wget ignoring robots
$ wget -e robots=off -r -np 'http://example.com/folder/'
  • -e robots=off causes it to ignore robots.txt for that domain
  • -r makes it recursive
  • -np = no parents, so it doesn't follow links up to the parent folder
@alirobe
alirobe / reclaimWindows10.ps1
Last active May 22, 2024 20:58
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@rafaelstz
rafaelstz / SnippetsHtaccess.md
Created March 10, 2015 17:08
Htaccess Snippets A collection of useful .htaccess snippets, all in one place.

.htaccess Snippets

A collection of useful .htaccess snippets, all in one place.

Disclaimer: While dropping the snippet into an .htaccess file is most of the time sufficient, there are cases when certain modifications might be required. Use at your own risk.

IMPORTANT: Apache 2.4 introduces a few breaking changes, most notably in access control configuration. For more information, check the upgrading document as well as this issue.

Credits

What we are doing here is mostly collecting useful snippets from all over the interwebs (for example, a good chunk is from Apache Server Configs) into one place. While we've been trying to credit where due, things might be missing. If you believe anything here is your work and credits should be given, let us know, or just send a PR.

@jordan-brough
jordan-brough / git-recent
Last active April 8, 2024 02:53
Git: Display a list of recently checked out branches/tags/commits
#!/usr/bin/env bash
# Source: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd
# See also: https://stackoverflow.com/a/25095062/58876
# Download this script as "git-recent" (no extension), chmod it to be executable and put it in your
# path somewhere (e.g. /usr/bin). You can then use it via `git recent` from inside any git repo.
# Examples:
@giraam
giraam / string-to-sha1.java
Last active May 17, 2023 17:55
Hashing a String with SHA1 in Java
import java.io.*;
import java.util.logging.*;
import javax.xml.bind.DatatypeConverter;
/**
* Hashing with SHA1
*
* @param input String to hash
* @return String hashed
*/