This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Is the file ending with a newline? Python Function | |
def ending_with_newline(filename): | |
last_byte = None | |
with open(filename, "rb") as f: | |
while True: | |
byte = f.read(1) | |
if not byte: | |
break | |
last_byte = byte |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Camera { | |
float pos_x; | |
float pos_y; | |
float pos_z; | |
float rot_x; | |
float rot_y; | |
float rot_z; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GearsKeyAdapter extends KeyAdapter { | |
public void keyPressed(KeyEvent e) { | |
int kc = e.getKeyCode(); | |
if(KeyEvent.VK_LEFT == kc) { | |
view_roty -= 1; | |
} else if(KeyEvent.VK_RIGHT == kc) { | |
view_roty += 1; | |
} else if(KeyEvent.VK_UP == kc) { | |
view_rotx -= 1; | |
} else if(KeyEvent.VK_DOWN == kc) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.EventQueue; | |
import java.awt.Font; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.LayoutManager; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.LayoutStyle; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import javax.swing.*; | |
import com.jogamp.opengl.*; | |
import com.jogamp.opengl.awt.GLCanvas; | |
import com.jogamp.opengl.glu.GLU; | |
public class HelloJOGL2 extends JFrame implements KeyListener{ |