Skip to content

Instantly share code, notes, and snippets.

@Vince0789
Vince0789 / db.pwn
Created July 8, 2021 16:45
SA-MP MySQL Connect
/**
* <summary>
* Gets the current database handle. This method acts like a singleton; if a
* connection doesn't exist, one is created.
* </summary>
* <returns>
* MySQL database handle.
* </returns>
*/
stock MySQL:GetDatabaseHandle()
@Vince0789
Vince0789 / pawn.json
Last active December 9, 2021 19:08
Snippets for vscode
{
"if": {
"prefix": "if",
"body": "if(${condition})\n{\n\t$0\n}"
},
"else": {
"prefix": "else",
"body": "else\n{\n\t$0\n}"
},
"enum": {
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
for (int i = 1; i <= 100; i++)
{
@Vince0789
Vince0789 / samp03svr
Last active January 9, 2020 22:57
Configuration file for logrotate to rotate SA-MP server logs.
/path/to/server/server_log.txt {
daily
rotate 30
dateext
extension .txt
olddir /var/log/samp03svr
missingok
compress
create
postrotate
@Vince0789
Vince0789 / rules.v4
Last active April 27, 2023 03:27 — forked from jirutka/rules-both.iptables
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <jakub@jirutka.cz>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# create a new chain
iptables -N SAMPQUERY
# check that incomming packet is a samp query packet and divert to the new chain
# this inserts the rule as the first in the chain, but should probably be a bit further down (e.g. after checking lo interface)
iptables -I INPUT -p udp \! -f -m udp --dport 7777 -m conntrack --ctstate NEW,ESTABLISHED -m u32 --u32 "0x0>>0x16&0x3c@0x8=0x53414d50" -j SAMPQUERY
# only allow connection from ephemeral source ports
# connection attempts from ports outside this range are likely rogue clients
iptables -A SAMPQUERY -p udp --sport 49152:65535 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
<?php
/**
* Converts a column name into the corresponding index (A = 0, B = 1, AA = 26, etc).
*
* @param string $name
* @return int
*/
function getColumnIndexFromName($name)
{
$chars = array_map(function($char) { return ord($char); }, str_split(strtoupper($name)));
www.youtube.com
www.youtub%65.com
www.youtu%62e.com
www.youtu%62%65.com
www.yout%75be.com
www.yout%75b%65.com
www.yout%75%62e.com
www.yout%75%62%65.com
www.you%74ube.com
www.you%74ub%65.com
0000
0001 AIRPORT THRW_BARL_THRW
0002 ATTRACTORS STEPSIT_IN
0003 ATTRACTORS STEPSIT_LOOP
0004 ATTRACTORS STEPSIT_OUT
0005 BAR BARCUSTOM_GET
0006 BAR BARCUSTOM_LOOP
0007 BAR BARCUSTOM_ORDER
0008 BAR BARMAN_IDLE
0009 BAR BARSERVE_BOTTLE
@Vince0789
Vince0789 / bipltool-batch.py
Last active January 30, 2019 21:22 — forked from blewert/bipltool-batch.py
An IPL decompiler for binary IPL data files for gta:sa.
## Benjamin Williams
## <eeu222@bangor.ac.uk>
## --
## bipltool.py/pyc
import os
import sys
import struct
import math