Skip to content

Instantly share code, notes, and snippets.

||organicowner.com^
||003153.xyz^
||ns.00dani.me^
||666.020202.best^
||0ms.dev^
||dns.0ooo.icu^
||0x3d.lu^
||dns.0x55.net^
||1010000.online^
||108023.xyz^
@tejzpr
tejzpr / grpo_demo.py
Created February 8, 2025 05:53 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
@tejzpr
tejzpr / gist:0e13d4e6eb6fa03015ad4ba272d74ca9
Last active April 27, 2023 01:35
Servicenow: oAuth Password grant authentication
(function execute(inputs, outputs) {
var provider = new sn_cc.StandardCredentialsProvider();
var credential = provider.getCredentialByID("credential_id");
var user = credential.getAttribute("user_name");
var pass = credential.getAttribute("password");
var oAuthClient = new sn_auth.GlideOAuthClient();
var params ={grant_type:"password", username:user, password:pass};
var json = new global.JSON();
var extraParams = json.encode(params);
@tejzpr
tejzpr / server.go
Created July 18, 2022 22:51 — forked from xcsrz/server.go
A golang web server on a randomly (os) chosen port.
package main
import (
"fmt"
"github.com/skratchdot/open-golang/open"
"net"
"net/http"
)
func main() {
@tejzpr
tejzpr / strstr.go
Created April 1, 2021 22:07
strstr in go
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strstr("Hello how how are you", "How"))
}

Keybase proof

I hereby claim:

  • I am tejzpr on github.
  • I am tejzpr (https://keybase.io/tejzpr) on keybase.
  • I have a public key ASAyqS7BrrmWS1qGZCUd1x--BNCoMgP8QHORWMe0RH6sNwo

To claim this, I am signing this object:

@tejzpr
tejzpr / fhvhash.go
Created March 1, 2021 18:00
FNV Hash - Go
package main
import "fmt"
func fnvHash32(key string) uint32 {
hash := uint32(2156825496)
const prime32 = uint32(16777619)
for i := 0; i < len(key); i++ {
hash *= prime32
hash ^= uint32(key[i])
@tejzpr
tejzpr / LICENSE
Last active March 6, 2021 04:10
This license applies to all my Public Gists unless another License is specifically applied in source code of that particular Gist.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
  1. Re-Order Lauchpad APPS
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
@tejzpr
tejzpr / dim-screen-ubuntu.txt
Last active June 5, 2018 05:02
Dim backlight in Intel Graphics based Laptops running Ubuntu 18.04 (Gnome or Budgie)
Open a terminal and run the following commands (cd to your home directory first)
sudo apt install xbacklight
xauth generate :0 . trusted
xauth add ${HOST}:0 . $(xxd -l 16 -p /dev/urandom)
sudo vi /etc/udev/rules.d/98-backlight.rules
Paste the following into the 98-backlight.rules
################################################# START ###################################
# Adjust screen brightness according to power state
# 1st rule for when on AC
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/USERNAME/.Xauthority", RUN+="/usr/bin/xbacklight -set 85"