Skip to content

Instantly share code, notes, and snippets.

View dukenmarga's full-sized avatar

Duken Marga dukenmarga

View GitHub Profile
public function setRho(){
$As = $this->concrete->getAs();
$B = $this->concrete->getB();
$D = $this->concrete->getD();
$this->rho = $As / ($B*$D);
}
@dukenmarga
dukenmarga / matplotlib-cherrypy.py
Last active January 26, 2024 10:07
matplotlib on CherryPy
# Modified from https://gist.github.com/tkf/1299670 by @tkf
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
import numpy
import cherrypy
from cStringIO import StringIO
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
import numpy
from flask import Flask, send_file
from cStringIO import StringIO
app = Flask(__name__)
@dukenmarga
dukenmarga / twitter_glow.css
Created August 19, 2014 04:38
Style for performing glow box like twitter did.
/* Twitter-like glowing box */
input[type=text], textarea {
transition: all 0.30s ease-in-out;
-webkit-transition: all 0.30s ease-in-out;
-moz-transition: all 0.30s ease-in-out;
border:#fff 1px solid;
outline:none;
padding: 3px 0px 3px 3px;
margin: 5px 1px 3px 0px;
border: 1px solid #DDDDDD;
@dukenmarga
dukenmarga / config_mailman.php
Created August 19, 2014 04:39
change config for many lists in mailman
<?php
$file = 'daftarMilis';
$f=fopen($file,'r');
while($list = fgets($f)){
$list = rtrim($list);
exec("echo 'reply_to_address =\042".$list."@ftsl.itb.ac.id\042' > config.data");
exec("echo 'reply_goes_to_list = 2' >> config.data");
exec("echo 'acceptable_aliases = \042".$list."@ftsl.itb.ac.id\042' >> config.data");
exec('/usr/sbin/config_list -i config.data '.$list);
}
@dukenmarga
dukenmarga / echo.py
Created August 19, 2014 04:40
echo to text
import os
os.system("echo 'reply_to_address =\042"+list+"@ftsl.itb.ac.id\042' > config.data")
@dukenmarga
dukenmarga / read_line.py
Created August 19, 2014 04:40
read file line per line and trim new line symbol
file = 'fileName'
f = open(file, 'r')
content = f.readlines()
size = len(content)
for i in range(size):
print content[i].rstrip()
@dukenmarga
dukenmarga / fix_url_bulk.php
Created August 19, 2014 04:41
perform bulk fix url list in mailman
<?php
/*
this script performs bulk fix url list in mailman
you can get url from command 'list_list -b > urlList'
urlList contain url per line
@author Duken Marga
*/
$f=fopen('urlList', 'r');
while($baris = fgets($f)){
$baris = rtrim($baris);
@dukenmarga
dukenmarga / numeric_integartion.c
Created August 19, 2014 04:42
Integrasi: gauss quadrature, simpson, dan jumlah atas dan bawah
/*
coder : duken marga
blog : http://duken.info
description : integrasi numerik menggunakan motoda trapezoidal,
gauss quadrature, simpson, dan jumlah atas dan bawah
*/
#include <stdio.h>
#include <math.h>
@dukenmarga
dukenmarga / secant_method.c
Created August 19, 2014 04:42
Secant Method
/*
* program untuk mencari solusi persamaan
* dengan menggunakan metode secant
* coder : duken marga
*/
#include <stdio.h>
#include <math.h>
#define PHI 3.141592654
#define TOLERANCE 10E-10