Skip to content

Instantly share code, notes, and snippets.

View natali's full-sized avatar

Natali Ardianto natali

View GitHub Profile
<?php
$total = 0;
$array1 = Array ( [tgl] => 07 [01] => 968 [total] => 35801 [02] => 29413 [03] => 731 [04] => 1172 [05] => 799 [06] => 1046 [07] => 1672 );
$array2 = Array ( [tgl] => 07 [01] => 820 [total] => 10949 [02] => 6042 [03] => 1067 [04] => 946 [05] => 915 [06] => 834 [07] => 325 );
// versi sederhana
unset($array1['tgl']);
$total += array_sum($array1);
unset($array2['tgl']);
@natali
natali / query_for_getting_course_time.sql
Created August 3, 2010 10:35
getting the available schedules, with interval 2:20 and grace period 20 minutes.
SELECT a.plantime_id AS plantime_id1, MIN(a.plan_time) AS plan_time1,
b.plantime_id AS plantime_id2, MIN(b.plan_time) plan_time2,
c.plantime_id AS plantime_id3, MIN(c.plan_time) plan_time3,
d.plantime_id AS plantime_id4, MIN(d.plan_time) plan_time4
FROM golf__timeslots a
JOIN golf__timeslots b
ON a.business_id = b.business_id
AND a.plan_date = b.plan_date
AND b.availability = 'available'
AND b.course_id = '1'
anonymous
anonymous / facebook.php
Created November 8, 2010 10:57
<?php
if (!function_exists('curl_init')) {
throw new Exception('Facebook needs the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
throw new Exception('Facebook needs the JSON PHP extension.');
}
/**
@christianroman
christianroman / OCR.java
Created May 15, 2012 01:59
Captcha OCR + Tesseract
public class OCR {
private static final String INPUT = "C:/captcha/ex.png";
private static final String OUTPUT = "C:/captcha/captcha-out.png";
private static final String TESSERACT_BIN = "C:/Program Files/Tesseract-OCR/tesseract.exe";
private static final String TESSERACT_OUTPUT = "C:/captcha/out.txt";
private static final int WHITE = 0x00FFFFFF, BLACK = 0x00000000;
public static void main(String... args) throws Exception {
BufferedImage image = ImageIO.read(new FileInputStream(INPUT));
int average = 0;
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
@mul14
mul14 / 00_etc-hosts.md
Last active June 16, 2024 10:41
/etc/hosts for Vimeo, Reddit, Imgur, GitHub, DigitalOcean, dll

Unblock Steam, Vimeo, Reddit, Imgur, GitHub, DigitalOcean, NPM, PayPal, dll

Saya support Internet Positif untuk memblokir porn, situs judi, dan hal-hal ilegal lainnya. Tapi pemerintah dan ISP sangat konyol karena tidak mengizinkan akses ke Vimeo, Reddit, Imgur, Netflix--yang mana bukanlah situs dengan konten utama ilegal.

Linux / BSD / macOS

Tambahkan list di bawah ke /etc/hosts.

Windows

{
"name": "receipt_text_detector",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Imre Nagi",
"engines": {
"node": ">=4.3.2"
},
"scripts": {