Skip to content

Instantly share code, notes, and snippets.

View krisanalfa's full-sized avatar

Krisan Timur krisanalfa

  • Denpasar, Bali
View GitHub Profile
@krisanalfa
krisanalfa / getIndexOf.cpp
Last active December 18, 2015 17:59
Get index of array, input something to a new array, and do any operation to that new array
#include <cstdlib>
#include <iostream>
using namespace std;
// Declare global variable here
string defaults[6] = { "Annisa", "Isyana", "Hifni", "Riska", "Alfa", "Omega" }; // Default array
int arrSize = sizeof(defaults) / sizeof(*defaults); // Ukuran array
float batasLulus = 6.5; // Batas lulusnya berapa? Kalo lebih dari ini, maka dinyatakan lulus
@krisanalfa
krisanalfa / eaccelerator.patch
Created October 31, 2013 09:56
eAccelerator Patch
--- eaccelerator.orig 2013-10-31 16:51:48.000000000 +0700
+++ eaccelerator.c 2013-10-31 16:52:20.000000000 +0700
@@ -63,7 +63,7 @@
#include "php.h"
#include "php_ini.h"
-#include "php_logos.h"
+/*#include "php_logos.h"*/
#include "main/fopen_wrappers.h"
#include "ext/standard/info.h"
@krisanalfa
krisanalfa / PKGBUILD
Created October 31, 2013 10:10
eAccelerator PHP for Arch Linux
# Maintainer: Krisan Alfa Timur <krisan47@gmail.com>
pkgname=eaccelerator-git
pkgver=1.0
pkgrel=2
pkgdesc="A free open-source PHP accelerator, optimizer, and dynamic content cache."
arch=('i686' 'x86_64')
url="http://eaccelerator.net/"
license=('GPL')
depends=('php')
@krisanalfa
krisanalfa / vmblock-9.0.2-5.0.2-3.12.patch
Created November 18, 2013 08:51
VMWare vmblock patch for 3.12 kernel. It's ony works for VMPlayer 5.0.2 or VMWare Workstation 9.0.2
diff -Naur a/linux/control.c b/linux/control.c
--- a/linux/control.c 2013-10-03 04:29:47.471339204 -0400
+++ b/linux/control.c 2013-10-03 04:31:56.607334636 -0400
@@ -283,7 +283,7 @@
int i;
int retval;
- name = getname(buf);
+ name = (char*)getname(buf)->name;
if (IS_ERR(name)) {
@krisanalfa
krisanalfa / pop-push.cpp
Last active January 8, 2019 00:53
[C++] POP PUSH dalam C++ menggunakan satu array dan dua stack.
/**
|----------------------------------------------------------------------------------
| README FIRST
|----------------------------------------------------------------------------------
| I HATE WINDOWS, SO I USE LINUX TO MAKE THIS SHIT WORKS
| BUT I LOVE KNOWLEDGE, SO I MAKE THIS ONE NOW WORKS FOR WINDOWS TO
| I HATE C++
| BUT I LOVE ANGELA CRISANTI, SO I DO THIS SHIT
| COMPILE WITH: g++ pop-push.cpp -o shitty
| RUN WITH : ./shitty
@krisanalfa
krisanalfa / phpinfo.php
Created January 8, 2014 11:00
My custom phpinfo page
<!DOCTYPE html>
<html>
<head>
<title>PHP INFO</title>
<style type="text/css">
body {font-family: "Ubuntu Mono", "Monospace", "Monaco", "Courier New"; font-size: 12px}
</style>
<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />
</head>
<body>
@krisanalfa
krisanalfa / oop.php
Created January 15, 2014 13:54
Simple PHP with funny story (=
<?php
class Binatang {
protected $name = 'something';
protected $suara = 'nothing';
public function __construct($name) {
$this->name = $name;
}
@krisanalfa
krisanalfa / magic_table_script.sh
Created January 20, 2014 05:24
Do any what you wanna do with your MySQL table with an iteration
#!/usr/bin/env bash
# Run this script with: bash magic_table_script.sh myDatabaseName
# Or you can work with multiple database by typing: bash magic_table_script.sh myDatabaseName,anotherDatabaseName,yetAnother
# I use root account for do this magic, so you could provide your root password below
# Change your database password here
mysqlRootPassword="my_S3cr3+_pa^^w012D"
function doWhatYouWannaDo() {
# Usage: doWhatYouWannaDo $dbname
@krisanalfa
krisanalfa / return.php
Created February 7, 2014 07:18
How return walk in PHP
<?php
$error = false;
function a() {
global $error;
$error = true;
var_dump('a');
}
@krisanalfa
krisanalfa / mongooo.sh
Created February 20, 2014 03:45
Export your Mongo database. Each collection has it's own .json file. So, we can import them later using this script.
#!/bin/sh
exportDb() {
echo "Exporting $1"
echo "db.getCollectionNames()" |
mongo $1 2> /dev/null |
grep '"' |
cut -d '"' -f 2 |
while read a; do
if [[ $a != "system.indexes" ]]; then