This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A program to estimate the formula for cost of an in-game item; | |
# Specifically, "Strength Upgrades" in Lumberjack Heroes in Fortnite | |
# https://chat.openai.com/c/e8e7f768-e9d7-4553-94aa-4e9b5b12d917 | |
# count,cost | |
# 1,55.8E45 | |
# 10,1.13E48 | |
# 100,11.5E51 | |
counts = [1, 10, 100] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment | |
pidigits digits = sum (map piterm [1..(digits - digits `div` 5)]) where | |
kk = 10 ^ digits | |
piterm k = kk * 16*(-1)^(k+1)`div`((2*k-1)*5^(2*k-1)) - kk * 4*(-1)^(k+1)`div`((2*k-1)*239^(2*k-1)) | |
main = do | |
args <- getArgs | |
let digits :: Integer = read (head args) | |
print $ pidigits digits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("focus", (event) => | |
navigator.clipboard.writeText(document.body.innerHTML) | |
.then(()=>console.log("string copied to clipboard")) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo Be sure to run this as administrator! | |
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge" /f | |
reg delete "HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Edge" /f | |
@echo Verify success | |
PAUSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop FUNCTION empty_tables; | |
CREATE OR REPLACE FUNCTION empty_tables() | |
RETURNS TABLE(name text) AS | |
$BODY$ | |
DECLARE | |
t record; | |
v_sql text; | |
hasdata bool; | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#https://gist.github.com/tallpeak/c8a9254370b24b8fbab6a5c803204370 | |
#based on https://www.guru99.com/selenium-python.html | |
from selenium import webdriver | |
from selenium.webdriver.common.by import * | |
from selenium.webdriver.support.ui import WebDriverWait | |
import sys | |
import os | |
arg1 = len(sys.argv) > 1 and sys.argv[1] or "" | |
if arg1 == "-f" or arg1 == "--full" or arg1=="f" or arg1=="full": | |
full = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simplified example of how to handle throttling of requests returned from the Shopify API | |
import json | |
import time | |
# The web API (GraphQL API) returns a JSON string similar to this: | |
content = b'{"throttleStatus":{"maximumAvailable":1000.0,"currentlyAvailable":990,"restoreRate":50.0}}' | |
obj = json.loads(content) # Convert it to a Python object (a map) | |
# Actual code to retrieve part of the object from the full JSON from the Shopify GraphQL API: | |
# throttleStatus = js["extensions"]["cost"]["throttleStatus"] | |
# Simplified: | |
throttleStatus = obj["throttleStatus"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import re | |
import os | |
pid = int(os.popen("grep -a ^./asmttpd /proc/[0-9]*/cmdline | cut -d/ -f3") .read()) | |
maps_file = open(f'/proc/{pid}/maps', 'r') | |
mem_file = open(f'/proc/{pid}/mem', 'rb', 0) | |
output_file = open("self.dump", 'wb') | |
for line in maps_file.readlines(): # for each mapped region | |
m = re.match(r'([0-9A-Fa-f]+)-([0-9A-Fa-f]+) ([-r])', line) | |
if m.group(3) == 'r': # if this is a readable region |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::HashMap; | |
fn main() { | |
let morse: Vec<&str> = vec![ | |
" ", "-.-.--", ".-..-.", "", "...-..-", "", ".-...", ".----.", "-.--.", "-.--.-", "", | |
".-.-.", "--..--", "-....-", ".-.-.-", "-..-.", "-----", ".----", "..---", "...--", | |
"....-", ".....", "-....", "--...", "---..", "----.", "---...", "-.-.-.", "", "-...-", | |
"", "..--..", ".--.-.", ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", | |
".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", | |
"...-", ".--", "-..-", "-.--", "--..", "", "", "", "", "..--.-" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
morse = [' ', '-.-.--', '.-..-.', '', '...-..-', '', '.-...', '.----.', '-.--.', '-.--.-', '', | |
'.-.-.', '--..--', '-....-', '.-.-.-', '-..-.', '-----', '.----', '..---', '...--', | |
'....-', '.....', '-....', '--...', '---..', '----.', '---...', '-.-.-.', '', '-...-', | |
'', '..--..', '.--.-.', '.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', | |
'.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', | |
'...-', '.--', '-..-', '-.--', '--..', '', '', '', '', '..--.-'] | |
ascii_value = 32 | |
morseAscii = {} |
NewerOlder