Skip to content

Instantly share code, notes, and snippets.

@KristerV
KristerV / fix-alien-armageddon-3-linux.sh
Last active March 18, 2020 14:50
Script fix Duke Nuken Alien Armageddon on Linux. Works partially. Makes a list of all filenames and fixes casing in all of the (same) files.
#!/bin/bash
# Change delimiter for the for each loop from space to newline
IFS=$(echo -en "\n\b")
countMain=0
countSub=0
# Make a list of all filenames in the game
findAllFiles=`find . -type f`
const request = async function() {
const response = await fetch('https://api.com/route');
const json = await response.json(); // or .text() for simpler data like String
console.log(json);
}
request();
# 1. Take file from Desktop with email contents
# 2. curl the mailgun API
cat ~/Desktop/email | \
curl -s --user 'api:key-YOURKEYHERE' \
https://api.mailgun.net/v3/YOUR-MAILGUN-DOMAIN/messages \
-F from='Your Name <your.email@gmail.com>' \
-F to='mailgun-list@domain.com' \
-F subject='Gotto change me every time' \
@KristerV
KristerV / ExpandAllFacebookGroup.js
Last active August 31, 2018 12:53
Scrape Facebook Group
/*
This will expand all of the posts and comments that is in the view. It will take a lot of time!
To use just paste this in your console (F12).
*/
var previousScrollheight = 0
scrollDown = function() {
var currentScrollheight = document.body.scrollHeight
var canScroll = currentScrollheight - previousScrollheight
previousScrollheight = document.body.scrollHeight
### Keybase proof
I hereby claim:
* I am kristerv on github.
* I am kristerv (https://keybase.io/kristerv) on keybase.
* I have a public key ASC8yZfPEz4hbu9oakOp3H2nhkGs-GMfpZ4kDanGVStm9wo
To claim this, I am signing this object:
wget http://out.redwall.ee/rangeforce/kliendile/rangeforce-1.0.zip
unzip rangeforce-1.0.zip -d rfweb
rm rangeforce-1.0.zip
cd rfweb/dist/
# Create Dockerfile
cat > ./Dockerfile <<EOL
FROM php
COPY . /var/www/myapp
CMD ["php", "-S", "0.0.0.0:80", "-t", "/var/www/myapp"]
[Service]
WorkingDirectory=/srv/heliumpay-budgetweb-backend/
ExecStartPre=/usr/bin/git checkout .
ExecStartPre=/usr/bin/git pull
ExecStartPre=/usr/bin/npm install
ExecStart=/usr/bin/nodejs /srv/heliumpay-budgetweb-backend/index.js
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=budgetweb-backend
# ZSH
apt install -y zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
cat >> ~/.oh-my-zsh/themes/robbyrussell.zsh-theme <<"EOL"
PROMPT='%{$fg_bold[green]%}$USER%{$reset_color%} ${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
EOL
cat >> ~/.zshrc <<"EOL"
zstyle ':completion:*' special-dirs true # ../ tab-completion
EOL
defmodule Arvuti do
def hashit(str, ind, result) do
hash = :crypto.hash(:md5 , str <> to_string(ind)) |> Base.encode16()
{pos, _} = :string.to_integer(to_char_list(String.slice(hash,5..5)))
letter = String.slice(hash, 6..6)
cond do
isdone(result) ->
result
String.slice(hash, 0..4) == "00000" && 0 <= pos && pos < 8 && String.slice(result, pos..pos) == "_" ->
result = String.slice(result, 0..pos-1) <> letter <> String.slice(result, pos+1..10)
defmodule Arvuti do
def hashit(str, ind, result) do
hash = :crypto.hash(:md5 , str <> to_string(ind)) |> Base.encode16()
cond do
String.length(result) >= 8 ->
result
String.slice(hash, 0..4) == "00000" ->
result = result <> String.slice(hash, 5..5)
IO.puts result
hashit(str, ind+1, result)