Skip to content

Instantly share code, notes, and snippets.

Avatar

Lamp ledlamp

View GitHub Profile
@ledlamp
ledlamp / fuidshift.js
Created Sep 26, 2020
recursively shift uids and gids
View fuidshift.js
const DIR = "rootfs";
const UID_SHIFT = 441248;
const GID_SHIFT = 441248;
var fs = require("fs");
var path = require("path");
(function recurseDirectory(dirpath){
let ls = fs.readdirSync(dirpath);
for (let itemname of ls) {
let itempath = path.join(dirpath, itemname);
View bfn4dv3.js
var t = (x,n) => x.length > n ? x = x.substr(n - 1) + '…' : x;
require("dotenv").config();
var https = require("https");
var Discord = require("discord.js");
var client = new Discord.Client();
client.login(process.env.TOKEN);
var lastPlayers, lastMessage;
@ledlamp
ledlamp / .sh
Last active Sep 23, 2020
command lines for screenshotting and upload to qonq from mac; I use with icanhasshortcut
View .sh
# full screen
SS=${TMPDIR}screenshot.png; screencapture -Cdt jpg $SS && URL=$(curl -H "Authentication: potato" -F "file=@$SS" https://qonq.gq/upload) && URL=$(tr -d '\n' <<< $URL) && pbcopy <<< $URL && osascript -e "display notification \"$URL\" with title \"Screenshot upload complete\"" && rm $SS
# selection
SS=${TMPDIR}screenshot.png; screencapture -idt png $SS && URL=$(curl -H "Authentication: potato" -F "file=@$SS" https://qonq.gq/upload) && URL=$(tr -d '\n' <<< $URL) && pbcopy <<< $URL && osascript -e "display notification \"$URL\" with title \"Screenshot upload complete\"" && rm $SS
@ledlamp
ledlamp / smcfancontrol.sh
Created Sep 22, 2020
force imac fans to base speed because of bad sensors
View smcfancontrol.sh
#!/bin/sh
/usr/local/bin/smc -k "FS! " -w 0007 # all forced mode
/usr/local/bin/smc -k "F0Tg" -w 1518 # ODD 1350 rpm
/usr/local/bin/smc -k "F1Tg" -w 1900 # HDD 1600 rpm
/usr/local/bin/smc -k "F2Tg" -w 12c0 # CPU 1200 rpm
@ledlamp
ledlamp / bfn4d.js
Created Sep 1, 2020
Bitfighter Notifier for Discord, version 2
View bfn4d.js
var https = require("https");
var lastPlayers;
(function check(){
https.get("https://bitfighter.org/bitfighterStatus.json", function(res) {
var body = "";
res.on("data", x => body += x);
res.on("end", () => {
try {
var status = JSON.parse(body);
@ledlamp
ledlamp / modpack-server.js
Created Mar 21, 2020
Technic Modpack Server; zip and stream the server's mods directly to the launcher
View modpack-server.js
var http = require("http");
var archiver = require("archiver");
var morgan = require("morgan");
var log = morgan("combined");
var server = http.createServer(function(req,res){
log(req, res, ()=>{});
var zip = archiver("zip");
zip.file("forge-1.12.2-14.23.5.2768-universal.jar", { name:"bin/modpack.jar" });
zip.directory("mods");
@ledlamp
ledlamp / dp.js
Created Mar 4, 2020
discord piano
View dp.js
global.G = global;
G.Discord = require("discord.io");
G.fs = require("fs");
G.serverID = "321819041348190249";
G.channelID = "600091812450795523";
G.tokens = fs.readFileSync("tokens.txt", "utf8").split("\n");
G.clients = tokens.map((token, index) => {
@ledlamp
ledlamp / journalctl.log
Created Jan 27, 2020
realvnc-virtuald 6.7.0 fails to start session on ubuntu desktop 18.04.3 lts wtf why?!?!
View journalctl.log
Jan 26 18:05:19 MBP92 vncserver-virtuald[30817]: Connections: connected: xxx.xx.xxx.xx::60086 (UDP)
Jan 26 18:05:19 MBP92 vncserver-virtuald[30817]: session started: user lamp permissions f
Jan 26 18:05:19 MBP92 vncserver-virtuald[30817]: Connections: authenticated: xxx.xx.xxx.xx::60086 (UDP), as lamp (security RA4_128)
Jan 26 18:05:19 MBP92 vncserver-virtuald[30817]: DaemonConnection: Launching new server instance for 204.62.111.60::60086 (UDP), lamp
Jan 26 18:05:19 MBP92 vncserver-virtuald[31317]: pam_unix(vncserver:session): session opened for user lamp by (uid=0)
Jan 26 18:05:19 MBP92 systemd-logind[836]: New session 117 of user lamp.
Jan 26 18:05:19 MBP92 systemd[1]: Started Session 117 of user lamp.
Jan 26 18:05:19 MBP92 vncserver-virtuald[30817]: Connections: transferring: xxx.xx.xxx.xx::60086 (UDP) to server :2
Jan 26 18:05:19 MBP92 Xvnc:2[31327]: session started: user lamp permissions f, transfer in
Jan 26 18:05:19 MBP92 vncserver-virtuald[30817]: Connections: completed: xxx.xx.xxx.xx::60086 (UDP) ([
@ledlamp
ledlamp / fof.js
Last active Dec 21, 2019
Play MIDI in manyland.com
View fof.js
var ws = ig.game.O868.ws
var keyMsgs = []
var useKeyboard = true // turns out guitar only has 33 unique notes while keyboard has 38
if (typeof useKeyboard != "undefined") {
var octaves = "=;>".split('')
var notes = "c cs d ds e f fs g gs a as b".split(' ')
for (let o of octaves)
for (let n of notes)
keyMsgs.push(`"m":"xf"U"i":"classic_piano*"o":${o},"n":"${n}?`)
View Color.js
if(typeof module !== "undefined") {
module.exports = Color;
} else {
this.Color = Color;
}
function Color() {
var r,g,b;
if(arguments.length === 1) {
var hexa = arguments[0].toLowerCase();
You can’t perform that action at this time.