Skip to content

Instantly share code, notes, and snippets.

@xorrbit
xorrbit / spectre.c
Created January 4, 2018 14:30 — forked from ErikAugust/spectre.c
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@xorrbit
xorrbit / drl_autohotkey.txt
Created November 2, 2016 14:38
DRL autohotkey script
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
$F2::
{
;multiplayer
MouseClick, left, 243, 213
Sleep, 500
;set region, east
@xorrbit
xorrbit / drtest.c
Last active October 20, 2016 14:26
drtest
// profiling results: http://imgur.com/a/lIFSY
// compiled on osx like so:
// gcc -o drtest_no_optimization drtest.c -pg
// gcc -o drtest_with_ofast drtest.c -pg -Ofast
// gcc -o drtest_with_otwo drtest.c -pg -O2
#include <stdlib.h>
#include <time.h>
#include <math.h>
@xorrbit
xorrbit / setup_mosh_centos.sh
Last active July 27, 2016 16:18 — forked from tancnle/setup_mosh_centos.sh
Setup mosh 1.2.5 on Centos 6.x
#!/bin/sh
# Update latest epel
sudo yum -y instlal epel-release
# perl-IO-Socket-IP isn't in the repos
wget http://rpm.mag-sol.com/Centos/6/x86_64/perl-IO-Socket-IP-0.31-1.el6.noarch.rpm
sudo rpm -Uvh perl-IO-Socket-IP-0.31-1.el6.noarch.rpm
rm perl-IO-Socket-IP-0.31-1.el6.noarch.rpm
Transport Canada issued a Civil Aviation Safety Alert to remind all persons operating unmanned aircraft (model aircraft and unmanned air vehicles or UAVs), for any purpose, about the safety impacts and consequences of interfering with manned aircraft operations, including firefighting aircraft.
This summer, a number of incidents occurred in British Columbia where manned aircraft fighting forest fires were grounded due to interference from unmanned aircraft. The Canadian Aviation Regulations state that no unauthorized person shall operate an aircraft within 5 nautical miles (9 km) of a forest fire or within any associated restricted airspace.
The Civil Aviation Safety Alert is also a reminder of the consequences of contravening regulations pertaining to the use of unmanned aircraft.
Please distribute the Alert or this message where appropriate.
Thank you,
@xorrbit
xorrbit / hide.freep.login.user.js
Last active August 29, 2015 14:17
hide freep login
// Install the Greasemonkey extension for Firefox or the Tampermonkey extension for Chrome
// then click the Raw button --->
// ==UserScript==
// @name hide freep login
// @namespace xorrbit
// @include http://*.winnipegfreepress.com/*
// @version v5
// @grant none
// ==/UserScript==
@xorrbit
xorrbit / average_power.sh
Created March 2, 2015 22:55
Shell script to calculate the average power of a GSM base station using my fork of kalibrate-hackrf.
file=`mktemp`
echo "Average power of channel $1:"
for i in {1..10};
do kalibrate-hackrf/src/kal -s GSM850 -c $1 2>&1 | sed -n 's/.*power: \([0-9.]*\)/\1/p' >> $file;
done
awk '{ total += $1; count++ } END { print total/count }' $file
rm $file
@xorrbit
xorrbit / convert.sh
Created June 9, 2014 14:54
shell script to convert mjpeg camera videos to a sane format (x264/aac in an mp4 container).
for FILE in `ls *AVI | sort` ; do
avidemux --nogui --output-format MP4 --video-codec x264 --audio-codec aac --load "$FILE" --save ${FILE%.*}.mp4 --quit
done
@xorrbit
xorrbit / gist:10472822
Created April 11, 2014 14:21
How to troll the cloudflare challenge
wget --no-check-certificate --post-data="---- BEGIN PRIVATE KEY ----\r\ntrololololololololol\r\n---- END PRIVATE KEY ----" https://www.cloudflarechallenge.com
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);
}