Skip to content

Instantly share code, notes, and snippets.

View catwhocode's full-sized avatar

Cat who code catwhocode

  • Jakarta, Indonesia
  • 18:17 (UTC +07:00)
  • Facebook felixphp
View GitHub Profile
@catwhocode
catwhocode / cherryd.py
Created October 1, 2015 04:51 — forked from dbinit/cherryd.py
CherryPy Django server
import os
import socket
import urllib
import urlparse
import cherrypy
# Django settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
# Celery loader
@catwhocode
catwhocode / unserialize-php-session.py
Last active August 7, 2016 12:14 — forked from scragg0x/gist:3894835
Unserialize PHP Session in Python
def unserialize_session(val):
if not val:
return
session = {}
groups = re.split("([a-zA-Z0-9_]+)\|", val)
if len(groups) > 2:
groups = groups[1:]
groups = map(None, *([iter(groups)] * 2))
for i in range(len(groups)):
@catwhocode
catwhocode / penanggalan.php
Last active June 29, 2017 09:17
latihan menampilkan listbox penanggalan hanya dengan php
<?php
$tanggalSekarang = date("j");
$bulanSekarang = date("n");
$tahunSekarang = date("Y");
// gunakan ini apabila php di-compile dengan opsi --enable-calendar
$jumlahHariBulanIni = cal_days_in_month(CAL_GREGORIAN, $bulanSekarang, $tahunSekarang);
// gunakan ini apabila php di-compile tanpa opsi --enable-calendar
// $jumlahHariBulanIni = date('t', mktime(0, 0, 0, $bulanSekarang, 1, $tahunSekarang));
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import csv
import urllib.request
url = input('Masukkan URL tempat file .CSV berada: ')
cari = input('Data yang akan anda cari: ')
nama_file = "file.csv"
pemisah = ";";
req = urllib.request.Request(url)
@catwhocode
catwhocode / perkalian_matriks.php
Last active December 16, 2020 07:15 — forked from f2face/perkalian_matriks.php
[PHP] Fungsi Perkalian Matriks
<?php
/* Fungsi perkalian matriks
* @f2face - 2013
*/
function kalikan_matriks($matriks_a, $matriks_b) {
$hasil = array();
for ($i = 0; $i < sizeof($matriks_a); $i++) {
for ($j = 0; $j < sizeof($matriks_b[0]); $j++) {
$temp = 0;
@catwhocode
catwhocode / encrypt_decrypt_openssl.php
Created April 20, 2021 20:39
PHP: Encrypt and Decrypt with OpenSSL
<?php
$simple_string = "Welcome to GeeksforGeeks\n";
// Display the original string
echo "Original String: " . $simple_string;
// Store the cipher method
$ciphering = "AES-128-CTR";
<?php
// taken from: https://www.amitmerchant.com/multiple-constructors-php/
class Animal
{
public function __construct()
{
$arguments = func_get_args();
$numberOfArguments = func_num_args();
' http://web.archive.org/web/20060527094535/http://www.nonhostile.com/howto-encode-decode-base64-vb6.asp
' http://cwestblog.com/2013/09/23/vbscript-convert-image-to-base-64/
Public Function ConvertFileToBase64(strFilePath As String) As String
Const UseBinaryStreamType = 1
Dim streamInput: Set streamInput = CreateObject("ADODB.Stream")
Dim xmlDoc: Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Dim xmlElem: Set xmlElem = xmlDoc.createElement("tmp")
<?php
// kalikan semua elemen array dengan bilangan 10
$arr = [1,2,3,4,5,6];
function kalikan($arr) {
foreach($arr as $key => $value) {
$arr[$key] = $value * 10;
}
return $arr;