Skip to content

Instantly share code, notes, and snippets.

View agusmakmun's full-sized avatar
🏠
Working from home

agusmakmun

🏠
Working from home
View GitHub Profile
@agusmakmun
agusmakmun / PapanCatur.java
Last active August 29, 2015 14:21
Ini adalah simple checker papan catur dengan menggunakan java programminr, methode input, contohnya: g7 > akan di check apakah hitam atau putih.
import java.util.Scanner;
/**
* Ini adalah simple checker papan catur dengan menggunakan java programming
* methode input, contohnya: g7 > akan di check apakah hitam atau putih.
* @author Agus Makmun (Summon Agus)
* @blog bloggersmart.net - python.web.id
* Thanks to: Gunawan Ariyanto
*/
@agusmakmun
agusmakmun / Array.java
Created May 27, 2015 08:45
Count Average and Standard Deviasi in Java
import java.util.Scanner;
/**
*
* @author agaust
*/
public class ArrayBaru {
public static void main (String [] args) {
String[] nama = {"Prabowo", "Cameron", "Beni"};
int[] nilai = new int[nama.length];
Scanner x = new Scanner(System.in);
@agusmakmun
agusmakmun / JavaScript Event click inside iframe
Last active November 13, 2015 20:54
Tables will be hidden when it was completed submit order.
<table id="table-show-hidden">
<tr>
<th>Produk</th>
<th>Jumlah</th>
<th>Total Harga</th>
<th>Aksi</th>
</tr>
</table>
<iframe id="myframe" src="/myframe/" frameborder="0" width="100%" height="500px"></iframe>
<ul class="nav navbar-nav">{% load menubuilder %}
{% menu headernavigation %}
{% for item in menuitems %}
<li>
<a href="{{ item.url }}" title="{{ item.title|escape }}"{% if item.current %} class='current active'{% endif %}>{{ item.title }}</a>
</li>
{% if submenu %}<ul>
{% for submenu in submenu_items %}
<li>{{ submenu.title }}</li>
{% endfor %}</ul>
@agusmakmun
agusmakmun / README.md
Created November 22, 2015 19:22 — forked from ndarville/README.md
From CSV to HTML table (Simple)

This code generates an HTML table based from a CSV file. This is from the tutorial by Christophe Viau.

In trying his code example, I discovered that the code doesn't work as-is, so I figured others might like to see a working d3.js example that did not rely on a pre-existing container HTML element.

The code remains the same except for some cosmetic tweaks.

The task of writing the CSS is left as an exercise for the reader.

@agusmakmun
agusmakmun / VirtualHost Aliases
Created December 4, 2015 22:40
run at Debian, by: Eka Puji Widiyanto
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
@agusmakmun
agusmakmun / login_twitter.py
Created December 10, 2015 16:32
Just Login to Twitter using cookielib
import urllib, urllib2, cookielib
username = 'username'
password = 'password'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
login_data = urllib.urlencode({'session[username_or_email]' : username, 'session[password]' : password})
opener.open('https://twitter.com/sessions', login_data)
resp = opener.open('https://twitter.com/yourname')
op = open("out_twitter.txt", "w")
@agusmakmun
agusmakmun / Download recrusive file in index-of.md
Created January 27, 2016 05:22
Download recrusive file in index-of in Linux using wget
$ wget -r --no-parent --reject "index.html*" http://125.160.17.22/dokumen/IGN/Panduan_OpenOffice.org_2.0/

For me I have to pass the --no-parent option, otherwise it will follow the link in the directory index on my site to the parent directory. So the command would look like this:

wget -r --no-parent http://mysite.com/configs/.vim/
@agusmakmun
agusmakmun / Filter and Count User was Joined by Date Joined.py
Last active January 27, 2016 07:45
Filter and Count User was Joined by Date Joined
# Refference:
# https://docs.djangoproject.com/en/dev/topics/db/queries/#retrieving-specific-objects-with-filters
# https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.extra
# http://stackoverflow.com/a/22085678/3445802
# http://stackoverflow.com/a/2283913/3445802
# http://stackoverflow.com/a/11174559/3445802
>>> from django.contrib.auth.models import User
>>> usr = User.objects.all().order_by('-date_joined')
>>> usr
>>> from itertools import permutations
>>> perms = [''.join(p)+"@gmail.com" for p in permutations('abc', 3)]
>>> for x in range(0, len(perms)):
... print (perms[x])
...
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]