Skip to content

Instantly share code, notes, and snippets.

View YetAnotherMinion's full-sized avatar

yam YetAnotherMinion

View GitHub Profile
@YetAnotherMinion
YetAnotherMinion / bit_wrangling.cpp
Last active August 29, 2015 14:12
Using structs and unions to bitwise slice a builtin type
#include <iostream>
using namespace std;
//Custom slicing type
struct Bar {
unsigned fn : 4; //first nibble
unsigned sn : 4; //second nibble
};
//Representation
union Foo {
short a;
@YetAnotherMinion
YetAnotherMinion / mem allocation.cpp
Created January 8, 2015 20:51
allocation using new intilaizers
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
char b = 'P';
char* c = new char('I');
char** d = new char*(new char('R'));
char** a = &c;
@YetAnotherMinion
YetAnotherMinion / filebuff.cpp
Created January 12, 2015 19:35
file buffer duplication using string streams
#include <vector>
#include <fstream>
#include <sstream>
#include <iostream>
int main(int argc, char* argv[]) {
if(argc != 3) {
std::cerr << "Usage: " << argv[0] << " <filename> <num_iters>" << std::endl;
return 0;
}
@YetAnotherMinion
YetAnotherMinion / if_else.bf
Created June 24, 2015 16:50
if else in brainfuck
if(a>=b) and else
assume input array is like this
0 1 0 A B 0
and we are pointing to A
+>+<[->-[>]<<]<[- BLOCK_A_GE_B]<[-< BLOCK_A_LT_B ]
@YetAnotherMinion
YetAnotherMinion / gist:5d6026b9a320231e16a5
Created July 8, 2015 16:51
Booting fedora without graphics card
@YetAnotherMinion
YetAnotherMinion / gist:26939126177b057f7598
Created July 13, 2015 19:55
CS resources before I loose them.txt
There were two WikiBooks that helped a lot:
http://en.wikibooks.org/wiki/Discrete_Mathematics/Set_theory
http://en.wikibooks.org/wiki/Set_Theory
For Discrete Maths I used the Mathematics for Computer Science text here: http://courses.csail.mit.edu/6.042/spring14/mcs.pdf
But I've since noticed that there's a full MIT OCW course for oen of the older versions (2010): http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/
from Queue import Queue, Empty
from threading import Thread
import threading
import time
import urllib2
from bs4 import BeautifulSoup
GLOBAL_PAGE_VIEW_COUNT = 1
page_view_lock = threading.Lock()
To spoof a MAC address to a different value:
$ sudo macchanger --mac=00:00:00:00:00:01 eth0
To spoof a MAC address to a random value while preserving the same OUI:
$ sudo macchanger -e eth0
To spoof a MAC address to a completely random value:
$ sudo macchanger -r eth0
To get all MAC address OUIs associated with a particular vendor (e.g., Juniper):

Genesis by George Gamon

In the beginning God created radiation and ylem, And ylem was without shape or number, and the nucleons were rushing madly over the face of the deep.

And God said, "Let there be mass two." And there was was mass two. And God saw deuterium and it was good.

And God said, "Let there be mass three." And there was mass three. And God saw tritium and it was good.

And God continued to call numbers until He came to the transuranic elements. But when He looked back on his work, He found it was not good. In the excitement of counting, He missed calling for mass five, and so, naturally, no heavier elements could have been formed.

Test project /home/shivaebola/Documents/GitHub/core/build
Start 1: shapefun
Could not find executable shapefun
Looked in the following places:
shapefun
shapefun
Release/shapefun
Release/shapefun
Debug/shapefun
Debug/shapefun