Skip to content

Instantly share code, notes, and snippets.

View rkkautsar's full-sized avatar
🏠

Rakha Kanz Kautsar rkkautsar

🏠
View GitHub Profile
@rkkautsar
rkkautsar / Template v1.0.cpp
Last active December 20, 2015 15:29
Programming Contest Template
//IO
#include <iostream> //#include <utility>
#include <fstream>
#include <sstream>
#include <iomanip>
//C Header
#include <cstdio>
#include <cstdlib>
#include <cstring>
@rkkautsar
rkkautsar / Template v.1.1.minimal.cpp
Last active August 29, 2015 14:04
Programming Contest Template
#include <bits/stdc++.h>
using namespace std;
// typedef
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
@rkkautsar
rkkautsar / Template v.1.1.ds.cpp
Last active August 29, 2015 14:04
Programming Contest Template
#include <bits/stdc++.h>
using namespace std;
// typedef
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef pair<int,ii> iii;
typedef pair<double,dd> ddd;
typedef vector<ll> vll;
@rkkautsar
rkkautsar / paintDrip.cpp
Last active August 29, 2015 14:23
Animate colorful, random paint drip art with SFML 1.6
#include <SFML/Graphics.hpp>
#include <vector>
#include <queue>
#include <cmath>
#include <iostream>
#include <ctime>
using namespace std;
const int width = 1366,
height = 768,
@rkkautsar
rkkautsar / Reader.java
Last active September 15, 2015 09:51
BufferedReader wrapper class
class Reader {
static BufferedReader br;
static InputStreamReader isr;
static StringTokenizer tokenizer=new StringTokenizer("");
static String buffer;
public Reader(){
isr = new InputStreamReader(System.in);
br = new BufferedReader(isr);
}
void drawArrow(Graphics g1, int x1, int y1, int x2, int y2) {
Graphics2D g = (Graphics2D) g1.create();
double dx = x2 - x1, dy = y2 - y1;
double angle = Math.atan2(dy, dx);
int len = (int) Math.sqrt(dx*dx + dy*dy);
AffineTransform at = AffineTransform.getTranslateInstance(x1, y1);
at.concatenate(AffineTransform.getRotateInstance(angle));
g.transform(at);
@rkkautsar
rkkautsar / app.js
Created February 20, 2016 08:58
Login SSO UI with Express.js and Passport
var express = require('express');
var passport = require('passport');
var CasStrategy = require('passport-cas2').Strategy;
var session = require('express-session');
var app = express();
var port = process.env.PORT || 3000;
app.use(session({secret: 'supersecretkey'}));
/**
* A. Internet Bandwidth
*
* Problem max flow straight-forward,
* accepted dengan algoritma Edmond-Karp
*/
#include <bits/stdc++.h>
using namespace std;
@rkkautsar
rkkautsar / cpptemplate.sublime-snippet
Created March 6, 2016 15:41
Sublime Text Snippets (Competitive Programming)
<snippet>
<content><![CDATA[
#include <bits/stdc++.h>
using namespace std;
// typedef
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef vector<int> vi;
@rkkautsar
rkkautsar / hide.rb
Created March 13, 2016 01:29
Steganography (RMagick)
#! /usr/bin/env ruby
require 'rmagick'
if ARGV.length < 3
puts "Usage: #{$0} input_file data output_file"
abort("ERROR: Wrong arguments")
end
input = ARGV[0]