Skip to content

Instantly share code, notes, and snippets.

View defrindr's full-sized avatar
👋
Hi there

Defri Indra Mahardika defrindr

👋
Hi there
View GitHub Profile
@vi
vi / reedsolomon.c
Created September 16, 2012 16:02
Simple command-line Reed-Solomon encoding and decoding tool
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ecc.h"
/* Reed-solomon command-line tool by Vitaly "_Vi" Shukela; 2012 */
/*
Usage:
1. Download http://sourceforge.net/projects/rscode/
@n3o77
n3o77 / evalDecoder.php
Created January 29, 2013 16:52
Decode PHP eval obfuscation
$string = "BASE 64 STRING";
$decode = strrev('edoced_46esab');
$result = eval(str_replace('eval', 'return', $decode($string)));
while (strstr($result, 'eval')) {
$result = eval(str_replace('eval', 'return', $result));
}
echo("<pre>".$result."</pre>");
@st3v
st3v / commit_dates.sh
Last active March 31, 2021 01:54
Manipulate Git Commit Dates
# Setting date at commit time:
GIT_COMMITTER_DATE="Tue Feb 7 22:47:34 2012 -0800" git commit -m "Ignore stuff" --date "Tue Feb 7 22:47:34 2012 -0800"
# Changing date for historical commit:
git filter-branch --env-filter 'if [ $GIT_COMMIT = <commit-id> ]
then
export GIT_AUTHOR_DATE="Tue Feb 7 22:47:34 2012 -0800"
export GIT_COMMITTER_DATE="Tue Feb 7 22:47:34 2012 -0800"
@anorth
anorth / ZoomLayout.java
Created March 29, 2014 00:06
Pinch-zoomable Android frame layout
package au.id.alexn;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.widget.FrameLayout;
@cferdinandi
cferdinandi / foreach.js
Last active October 1, 2020 08:01
A simple forEach() implementation for Arrays, Objects and NodeLists. Forked from ForEach.js by Todd Motto. https://github.com/toddmotto/foreach
/**
* A simple forEach() implementation for Arrays, Objects and NodeLists
* @private
* @param {Array|Object|NodeList} collection Collection of items to iterate
* @param {Function} callback Callback function for each iteration
* @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`)
*/
var forEach = function (collection, callback, scope) {
if (Object.prototype.toString.call(collection) === '[object Object]') {
for (var prop in collection) {
@talnetd
talnetd / crud.c
Created February 12, 2015 15:59
Simple CRUD in C to understand how one connect to DATABASE
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#define MAX_DATA 512
#define MAX_ROWS 100
struct Address {
@aenglander
aenglander / htaccess_router.php
Created April 2, 2015 17:50
PHP .htaccess router for built in web server
<?php
if (file_exists($_SERVER['SCRIPT_FILENAME'])) {
return false;
}
$_SERVER['DOCUMENT_ROOT'] = empty($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['PWD'] . '/www' : $_SERVER['DOCUMENT_ROOT'];
$htaccess = $_SERVER['DOCUMENT_ROOT'] . '/.htaccess';
$rewrites = array();
if (file_exists($htaccess)) {
$fp = fopen($htaccess, "r");
@PurpleBooth
PurpleBooth / README-Template.md
Last active June 10, 2024 06:12
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@r3verser
r3verser / AccessBehavior.php
Last active December 7, 2022 08:22
Yii2 Redirects all users to login (or any) page if not logged in, but allow access to some pages (like signup, password recovery etc.)
<?php
/*
* In configuration file
* ...
* 'as AccessBehavior' => [
* 'class' => 'app\components\AccessBehavior',
* 'allowedRoutes' => [
* '/',
* ['/user/registration/register'],
@littlefuntik
littlefuntik / ActiveController.php
Created January 4, 2016 17:04
Yii2 rest Serializer example
<?php
namespace app\rest;
use yii\filters\AccessControl;
use yii\filters\auth\CompositeAuth;
use app\components\HeaderParamAuth;
/**
* Description of ActiveController