Skip to content

Instantly share code, notes, and snippets.

@alaingilbert
alaingilbert / main.go
Created January 31, 2024 21:23
quick hack to extract and decode text out of a pdf
package main
import (
"bytes"
"os"
"os/exec"
"regexp"
"strconv"
)
@alaingilbert
alaingilbert / main.go
Last active March 15, 2023 09:29
chrome webstore downloader
package main
import (
"encoding/binary"
"fmt"
"io"
"net/http"
"net/url"
"os"
"regexp"
@alaingilbert
alaingilbert / geforecenow-afk.scpt
Last active November 28, 2022 23:44
GeForceNOW anti anti-afk AppleScript
on GetApplicationCorrespondingToProcess(process_name)
tell application "System Events"
set application_file to file of (application processes where name is process_name)
end tell
return application_file as string
end GetApplicationCorrespondingToProcess
repeat
tell application "System Events"
@alaingilbert
alaingilbert / cargo.toml
Created September 7, 2022 06:17
rust bankers
[package]
name = "rs-bankers"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.21.0", features = ["full"] }
tokio-scoped = "0.2.0"
@alaingilbert
alaingilbert / main.go
Last active August 10, 2022 01:01
doordash problem
package main
func max(x, y int) int {
if x < y {
return y
}
return x
}
type Node struct {
@alaingilbert
alaingilbert / index.html
Last active May 5, 2021 12:48
testing async/await in js
<script>
async function run() {
let res = 0;
for (let i = 0; i < 3; i++) {
const response = await fetch('https://jsonplaceholder.typicode.com/todos/1');
const json = await response.json();
res += json.id;
}
console.log(res);
}
@alaingilbert
alaingilbert / challenge.sh
Created April 11, 2017 05:33
Rainforestqa challenge
# Solution by Alain Gilbert
# http://letsrevolutionizetesting.com/challenge
curl -s http://letsrevolutionizetesting.com/challenge.json > tmp.json
while grep --quiet "follow" tmp.json; do
sed "s/challenge/challenge.json/g" tmp.json > tmp1.json
curl -s $(cat tmp1.json | jq -r '.follow') > tmp.json
done
cat tmp.json | jq -r '.message'
rm tmp.json tmp1.json
// Key bindings user:
{ "keys": ["alt+super+r"], "command": "refresh_namespaces_in_repl"},
import re
import sublime
import sublime_plugin
import SublimeREPL.sublimerepl
import SublimeREPL.text_transfer
class RefreshNamespacesInReplCommand(SublimeREPL.text_transfer.ReplTransferCurrent):
def run(self, edit):
ns = re.sub("ns\s*", "", self.view.substr(self.view.find("ns\s*\S+",0)))
text = "(require '%s :reload)" % ns
@alaingilbert
alaingilbert / vessel.sh
Last active August 29, 2015 14:10
vessel.sh
# Solution by Alain Gilbert
# http://www.vessel.com/careers
while grep "eval(" apply.rb > /dev/null; do
sed "s/eval/puts/g" apply.rb > 'tmp.rb';
ruby tmp.rb > 'apply.rb';
done
cat apply.rb