Skip to content

Instantly share code, notes, and snippets.

View dogterbox's full-sized avatar
😴
Working from home

Teerapong Taengmuang dogterbox

😴
Working from home
View GitHub Profile
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
public class Bresenham {
public static void main(String[] args) {
JFrame f = new JFrame();
@dogterbox
dogterbox / twitter_to_wordcloud.py
Last active March 9, 2018 08:49
Twitter streaming to Word cloud
from twitter import Twitter, OAuth
from wordcloud import WordCloud, STOPWORDS
import json
def to_file(text, filename="output.txt"):
with open(filename, "w", encoding="utf-8") as text_file:
text_file.write(text)
@dogterbox
dogterbox / MainWork2.java
Last active March 29, 2018 13:38
Image to GIF file
package CG;
import java.awt.Color;
import java.awt.Graphics;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import javax.swing.JFrame;
import javax.swing.JPanel;
from PIL import Image
import os
import shutil
print('---Image resize---')
print('Path folder example : /Users/HelloUsers/Pictures/MyPhoto\n')
while(True):
path_folder = input('Path folder : ')
if(os.path.isdir(path_folder)):
break
@dogterbox
dogterbox / LPUL.js
Last active October 17, 2018 16:12
Largest Penalty per Unit Length (LPUL)
/*
data input format
list = [[t1,p1],
[t2,p2],
[t3,p3],
[.....]]
*/
list = [[10,1],
[10,7],
"""
To install the matplotlib module :
https://matplotlib.org/users/installing.html
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
@dogterbox
dogterbox / Circle.java
Created October 30, 2018 16:37
genFlower
package Assignment3;
import java.awt.Color;
import java.awt.Graphics;
public class Circle
{
private int _x,_y;
private int _size;
private Color _color;
@dogterbox
dogterbox / Animate.java
Created October 30, 2018 16:44
AnimateSeason
package Assignment4;
import java.awt.*;
import java.util.*;
import java.applet.*;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
public abstract class Animate extends Applet implements Runnable{
public abstract void workspace() throws InterruptedException;
/*Dogter Box*/
%%
%class Lexer
%standalone
%public
%unicode
%{
String[] symTable = new String[100];
selectionSort <- function(num) {
for (i in seq(1, (length(num) - 1))) {
index <- i # index of min number
for (j in seq(i, length(num))) {
if (num[j] < num[index]) {
index <- j
}
}
# swap number
minNum <- num[index]