Skip to content

Instantly share code, notes, and snippets.

@ValentinFunk
ValentinFunk / cl_playermodel.lua
Last active January 30, 2018 23:25
Put this in Pointshop2/lua/ps2/modules/mu_integration/cl_playermodel.lua
hook.Add("PS2_GetPreviewModel", "ForMurder", function()
if GAMEMODE.Spectating then
return {
model = player_manager.TranslatePlayerModel("male03"),
bodygroups = "0",
skin = 0
}
end
end)
@ValentinFunk
ValentinFunk / Dockerfile
Created January 30, 2018 10:10
Dockerfile for firebase bug
FROM node:6.11-slim
RUN yarn global add firebase-tools
RUN mkdir app
WORKDIR /app
RUN mkdir functions
COPY functions/package.json functions/package.json
RUN cd functions && yarn
COPY . .
local function generateStattrakItemInfo( itemClass, itemChance )
local info = {
chance = itemChance * 0.1, -- 10% chance of original item = get stattrak item
itemOrInfo = {
isInfoTable = true,
item = itemClass,
getIcon = function()
local icon = vgui.Create("DCsgoItemIcon")
icon:SetItemClass(itemClass)
-- Force border to red
@ValentinFunk
ValentinFunk / install.sh
Last active December 13, 2017 15:32
Install Minikube
# Setup minikube
mkdir ~/kube
cd ~/kube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTREPORTERRORPROMPT=false
export MINIKUBE_HOME=$HOME
@ValentinFunk
ValentinFunk / sh_playermodel_list.lua
Created December 3, 2017 15:14
Playermodel Lua. Put this into garrysmod/lua/autorun/sh_playermodel_list.lua
AddCSLuaFile()
--[[
Follow this template to add playermodels to the picker and make the hands work.
You need to make sure that the playermodels are downloaded on the client as well (i.e. FastDL or Workshop Download).
This is the template:
player_manager.AddValidModel( "<name>", "<player model path>" )
player_manager.AddValidHands( "<name>", "models/weapons/c_arms_cstrike.mdl", 0, "10000000" )
]]--
@ValentinFunk
ValentinFunk / unzip.js
Created November 29, 2017 19:05
Unzip a stream in Node.JS
import * as request from 'request';
import * as shx from 'shelljs';
import * as fs from 'fs';
import * as unzip from 'unzipper';
import * as through from 'through2';
import * as Vinyl from 'vinyl';
function downloadLatestArtifact(gitlabToken: string, tokenType: 'PRIVATE-TOKEN' | 'JOB-TOKEN') {
// Download and unzip
const files = [];
@ValentinFunk
ValentinFunk / source.sh
Created November 28, 2017 09:24
Source a .env File while escaping stuff
sed -E -n 's/[^#]+/export &/ p' .env | while read line ; do echo $(printf %q "$line") | eval ; done
@ValentinFunk
ValentinFunk / cl_open.lua
Last active November 14, 2017 15:12
Open Pointshop2 with a key other than the F keys, this example uses F6. Save as lua/autorun/sh_ps2_keywatcher.lua
if SERVER then
AddCSLuaFile()
return
end
local lastDown = 0
local function hkKey()
if input.IsKeyDown( KEY_F6 ) and CurTime() > lastDown + 1 then
lastDown = CurTime()
RunConsoleCommand("pointshop2_toggle")
@ValentinFunk
ValentinFunk / sv_mixin_weaponrestrict.lua
Created November 7, 2017 10:10
Restrict Weapons to a certain Team. Place in lua/autorun/server
local RestrictWeaponMixin = {}
function RestrictWeaponMixin:included( klass )
local oldGiveWeapon = klaas.GiveWeapon
klass.GiveWeapon = function(self)
if self:GetOwner():Team() == TEAM_PRISIONER then
if string.find(self.weaponClass, "csgo") then
return oldGiveWeapon(self)
end
self:GetOwner():ChatPrint("[Pointshop 2] Not giving you " .. self:GetPrintName() .. " since you are a prisioner.")
return
@ValentinFunk
ValentinFunk / sv_pointsfixer.lua
Created October 23, 2017 22:28
Pointshop 2 negative points fixer
local function fixPts()
if not Pointshop2 or not Pointshop2.DB or not Pointshop2.DB.ConnectionPromise then
MsgC(Color(255, 0, 0), "ERROR: Pointshop2 is not loaded yet. Please rerun.")
return
end
print("[FIXPTS] -> Fetching minimum values")
Pointshop2.DB.ConnectionPromise:Then(function()
print('[FIXPTS] -> Connected to database')
return Pointshop2.DB.DoQuery('SELECT MIN(points) as minPoints, MIN(premiumPoints) as minPrem FROM ps2_wallet;')