Skip to content

Instantly share code, notes, and snippets.

View retep998's full-sized avatar
🐇
Very fluffy

Peter Atashian retep998

🐇
Very fluffy
  • Massachusetts, USA
View GitHub Profile
@retep998
retep998 / Backup.cpp
Created August 26, 2011 22:56
Backup system
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
using namespace boost::filesystem;
using boost::lexical_cast;
//std
#include <iostream>
#include <string>
#include <fstream>
#include <map>
for (unsigned int a = 0; a < 10; ++a) {
for (unsigned int b = 0; b < 10; ++b) {
for (unsigned int c = 0; c < 10; ++c) {
for (unsigned int d = 0; d < 10; ++d) {
for (unsigned int e = 0; e < 10; ++e) {
if (a*b == 24 && d == b/2 && d+e == a+c && a+b+c+d+e == 26) {
cout << a << b << c << d << e << endl;
}
}
}
@retep998
retep998 / 1.java
Created September 17, 2012 17:52
All my Java work
public class Triangle{
private static void g1(int n1){for(int n3=0;n3<n1;n3++){g2(n1-n3-1,' '); g2(n3*2+1,'x');g3();}}
private static void g2(int n1, char n2){for(int n3=0;n3<n1;n3++){System.out.print(n2);}}
private static void g3(){System.out.println();}
public static void main(String[] args){g1(4);}
}
#include <iostream>
#include <algorithm>
#include <ctime>
#include <random>
using namespace std;
size_t const s = 0x1000000;
size_t a[s];
template <typename T>
void test(T f) {
clock_t c1 = clock();
@retep998
retep998 / gist:4096084
Created November 17, 2012 13:45
Number factoring
#include <cstdio>
#include <ctime>
#include <cstring>
using namespace std;
const size_t s = 0x100;
const size_t ss = s * s;
size_t * p;
bool t[ss] = {};
void prepare() {
for (size_t i = 2; i < s; ++i) if (!t[i]) for (size_t j = i * i; j < ss; j += i) t[j] = true;
@retep998
retep998 / Brainfuck.cpp
Created November 26, 2012 19:30
Brainfuck
#include <iostream>
#include <fstream>
#include <filesystem>
#include <cstdint>
using namespace std;
using namespace std::tr2::sys;
size_t const msize = 0x100000;
void bf(path name, path input, path output) {
ifstream file(name, ios::binary);
ifstream inf(input, ios::binary);
@retep998
retep998 / gist:4226732
Created December 6, 2012 18:18
NX png dumper
//////////////////////////////////////////////////////////////////////////
// Copyright 2012 Peter Atechian (Retep998) //
//////////////////////////////////////////////////////////////////////////
// This file is part of the NoLifeStory project. //
// //
// NoLifeStory is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
@retep998
retep998 / gist:4653644
Created January 28, 2013 07:25
Vana topic
[SIZE=4]Background[/SIZE]
A group of developers want to create a better TitanMS core. I have tried to contact koolk so that he would let us have a repository and a bug tracking system, but he haven't replied. So we decided to take it upon ourselves to fork and develop a better TitanMS. At the same time, MooMoo opened his/her [URL="http://&quot;http://dev.chiasoft.net&quot;"]development forum[/URL] so we took that as our base. The core developers of Vana are project leaders there.
[SIZE=4]Why "Vana"?[/SIZE]
When we decided that we want to fork, we need a name. I suggested that we take the name "Vana", from "Vanadium" which is "Titanium"+1 in the periodic table of elements.
[SIZE=4]What is a fork?[/SIZE]
See: [URL="http://en.wikipedia.org/wiki/Fork_(software_development)"]Fork (software development - Wikipedia, the free encyclopedia)[/URL]
[SIZE=4]Credits[/SIZE]
@retep998
retep998 / Euler.cpp
Last active December 11, 2015 21:28
Project Euler source code
#include <iostream>
#include <cmath>
#include <cstdint>
#include <memory>
#include <vector>
#include <chrono>
#include <thread>
using namespace std;
using namespace std::chrono;
using namespace std::this_thread;
@retep998
retep998 / Texture.java
Created April 9, 2013 08:24
A quick fix for the HD texturepack performance bug. https://mojang.atlassian.net/browse/MC-13206
public void copyFrom(int par1, int par2, Texture par3Texture, boolean par4)
{
if (this.textureTarget != 32879)
{
ByteBuffer bytebuffer = par3Texture.getTextureData();
this.textureData.position(0);
bytebuffer.position(0);
/* Forge:
*