Skip to content

Instantly share code, notes, and snippets.

Douglas Sherk DouglasSherk

Block or report user

Report or block DouglasSherk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Craigslist Post Classifier.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
DouglasSherk / arrayx_test.sma
Created Apr 18, 2017
A test case for the ArrayX API.
View arrayx_test.sma
testLotsOfData() {
new array = array_create()
for (int i = 0; i < 1000000; i++) {
array_set_int(array, 0, 1)
* What? This was segfaulting after some large i, usually ~:
* 100000 < i < 500000
array_delete(array, 0)
DouglasSherk /
Created Apr 16, 2017
Temporary fix for ArrayX `clear()` function
* Use this in place of `array_get_int()` as the former mishandles
* parameters and needs to be wrapped safely.
stock array_get_int_safe(array, index) {
// Insert a dummy canary into the stack.
new dummy[32]
// Call a native (VM function) using the dummy variable to get
// rid of "unused symbol" warnings.
DouglasSherk / ARP_NPCs.sma
Created Apr 16, 2017
ARP NPCs base package plugin.
View ARP_NPCs.sma
// A callback called for all ARP plugins when the ARP core is loaded.
public ARP_Init() {
new line[256]
new name[32], Float:origin[3], Float:angle, model[128]
while (read_file(NPCS_FILE, line, 255)) {
parse_line_to_npc(line, name, 32, origin, angle, model, 128)
ARP_RegisterNpc(name, origin, angle, model, "handleNpcUsed")
DouglasSherk /
Created Apr 16, 2017
ARP NPCs API simplified, header.
* Registers an NPC or zone. Note that this actually creates
* the NPC for you and sets it up as well.
* @param name[] name of the NPC, ex. "Edeka Cashier"
* @param Float:origin[3] where to spawn the NPC
* @param Float:angle which direction it should face (0.0-180.0)
* @param model[] the model the NPC should use (if not a zone)
* @param handler[] function to call when a user presses "e" next to it
* @param property[] the internal name of the property that it belongs to
DouglasSherk / ARP_Core_NPCs.sma
Created Apr 16, 2017
ARP NPCs API simplified.
View ARP_Core_NPCs.sma
// ARP_Core.sma
// Handler for NPC registration API call
public _ARP_RegisterNpc(plugin, params) {
new ent = create_entity("info_target")
entity_set_string(ent, EV_SZ_classname, NPC_CLASSNAME) // "arp_npc"
entity_set_string(ent, EV_SZ_model, NPC_MODEL) // "711clerk"
// Store the registering plugin on the NPC so we can notify it of events later
entity_set_int(ent, EV_INT_iuser3, plugin)
DouglasSherk / bank_account.sma
Created Apr 13, 2017
ARP - Withdrawing from a user's bank account
View bank_account.sma
new amount = str_to_num(request)
new bank = ARP_GetUserBank(id)
if (amount < 1) {
client_print(id, print_chat, "[ARP] Invalid amount; please enter a whole number.")
if (amount > bank) {
client_print(id, print_chat, "[ARP] You do not have enough money in your bank account.")
DouglasSherk / bank_account.sma
Created Apr 13, 2017
HWRP - Withdrawing from bank account
View bank_account.sma
new authid[32], query[256]
format( query, 255, "SELECT wallet FROM money WHERE steamid='%s'", authid)
result = dbi_query(dbc,query)
if( dbi_nextrow( result ) > 0 )
new buffer[32],wallet
wallet = str_to_num(buffer)
DouglasSherk /
Last active Aug 29, 2015
MAC Address Randomizer
# You might want to note your old MAC address here. Use this to get it:
# ifconfig en0 | grep ether
MAC_ADDRESS=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
echo "Setting MAC address..."
sudo ifconfig en0 ether $MAC_ADDRESS
ifconfig en0 | grep ether
You can’t perform that action at this time.