Skip to content

Instantly share code, notes, and snippets.

View KingCprey's full-sized avatar
👌
yote

KingCprey KingCprey

👌
yote
  • England
View GitHub Profile
@KingCprey
KingCprey / fivem_keys.lua
Last active September 30, 2024 09:02
FiveM IsControlPressed keys
--IsControlPressed(0,x)
local keys={}
keys[34]="A"
keys[29]="B"
keys[26]="C"
keys[30]="D"
keys[46]="E"
keys[49]="F"
keys[47]="G"
keys[74]="H"
@KingCprey
KingCprey / siegify_docs_bookmarklet.js
Created May 22, 2017 16:45
Turn Google Docs icons into random siege characters
javascript:(function(){
function ranchoice(arr){return arr[Math.floor(Math.random()*arr.length)];}
function getval(prop){
if(prop instanceof Array){return ranchoice(prop);
}else{return prop;}
}
function change(div,name,pic){
if(pic==null&&typeof(name)==="object"){
if(name.hasOwnProperty("pic")){pic=getval(name.pic);}
if(name.hasOwnProperty("name")){name=getval(name.name);}
@KingCprey
KingCprey / siegify_docs.js
Created May 22, 2017 16:42
Turn Google Docs icons into random siege characters
function ranchoice(arr){return arr[Math.floor(Math.random()*arr.length)];}
function getval(prop){
if(prop instanceof Array){return ranchoice(prop);
}else{return prop;}
}
function change(div,name,pic){
if(pic==null&&typeof(name)==="object"){
if(name.hasOwnProperty("pic")){pic=getval(name.pic);}
if(name.hasOwnProperty("name")){name=getval(name.name);}
}
@KingCprey
KingCprey / chachachanka.py
Last active May 22, 2017 16:04
Bro do you even chanka
import os
def gimmeinput(prompt):
try:return raw_input(prompt)
except:return input(prompt)
try:
while True:
i=gimmeinput("How many cha chas u want? ")
try:
chia=int(i)
chanka="Cha"
@KingCprey
KingCprey / tachankify_docs_bookmarklet.js
Created May 22, 2017 14:33
EL EM GEE Docs - Bookmarklet
javascript:(function(){
var new_name="Anonymous Tachanka";
var chanka_pic="https://i.imgur.com/ZERv1w1.jpg";
var all_divs=document.querySelectorAll(".docs-presence-plus-collab-widget-container.goog-inline-block.docs-presence-plus-collab-widget-focus");
for(var i=0;i<all_divs.length;i++){
all_divs[i].setAttribute("data-tooltip",new_name);
all_divs[i].setAttribute("aria-label",new_name);
var img=all_divs[i].querySelector("img");
if(img!=null){img.setAttribute("src",chanka_pic);
img.setAttribute("alt",new_name);}
@KingCprey
KingCprey / tachankify_docs.js
Last active May 22, 2017 14:32
LMG MOUNTED AND LOADED - Google Docs
var new_name="Anonymous Tachanka";
var chanka_pic="https://i.imgur.com/ZERv1w1.jpg";
var all_divs=document.querySelectorAll(".docs-presence-plus-collab-widget-container.goog-inline-block.docs-presence-plus-collab-widget-focus");
for(var i=0;i<all_divs.length;i++){
all_divs[i].setAttribute("data-tooltip",new_name);
all_divs[i].setAttribute("aria-label",new_name);
var img=all_divs[i].querySelector("img");
if(img!=null){img.setAttribute("src",chanka_pic);img.setAttribute("alt",new_name);}
}
@KingCprey
KingCprey / test_bot.js
Created April 19, 2017 07:02
Tampermonkey script
// ==UserScript==
// @name Reddit Upvote Bot
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.reddit.com/*
// @grant none
// ==/UserScript==
(function() {
@KingCprey
KingCprey / compare_dirs.py
Created April 8, 2017 22:22
Python Script to compare directories
import os,hashlib
dir_orig="yo momma"
dir_new="another one"
def splitPath(p):return p.split(os.sep)
def mapDirs(dp,topdown=True):
alldirs={"dirs":{}}
for root,dirs,files in os.walk(dp,topdown=topdown):
for d in dirs:
path=splitPath(os.path.join(root,d))
m=alldirs
@KingCprey
KingCprey / py_filter_numbers.py
Created November 25, 2016 22:41
Python methods to extract
def extractDigits(s):return "".join(filter(str.isdigit,s))
def extractInt2(s):return int(filter(str.isdigit,s))
def extractInt3(s):return int("".join(filter(str.isdigit,s)))
s="abc100"
#Return string
"".join(filter(str.isdigit,s))
#Return ints
int(filter(str.isdigit,s))
int("".join(filter(str.isdigit,s)))
@KingCprey
KingCprey / vbn_cd_tray.vb
Created November 20, 2016 21:35
VB.NET code to open and close cd tray
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal Command As String, ByVal ReturnString As String, ByVal ReturnLength As Long, ByVal hWnd As Long) As Long
'Open CD Drive
'mciSendString("set cdaudio door open",0,0,0)
'Close CD Drive
'mciSendString("set cdaudio door closed",0,0,0)