Skip to content

Instantly share code, notes, and snippets.

View jvoytech's full-sized avatar

voytech jvoytech

View GitHub Profile
@jvoytech
jvoytech / test.cpp
Created January 27, 2020 17:27
table vs. pointer, differences
#include <cstdio>
void F(int *x, int tab1[2], int tab2[]) {
printf("F: sizeof x, tab1, tab2: %ld %ld %ld\n", sizeof(x), sizeof(tab1), sizeof(tab2));
}
int main() {
int tab[] = {1,2,3,4,5};
int* x = tab;
import java.util.ArrayList;
import java.util.List;
public class TestListPop {
private final List<String> states = new ArrayList<>();
public void push(String state) {
states.add(state);
}
@jvoytech
jvoytech / tkcad1.py
Created March 14, 2019 20:24
tkinter, canvas, grid snapping
import tkinter as tk
import tkinter.ttk as ttk
app = tk.Tk()
#app.geometry('800x600')
X = 1200
Y = 750
GRID = 25
@jvoytech
jvoytech / tk_excel.py
Created March 14, 2019 20:18
simple Tkinter excel spreadsheet cells
import tkinter as tk
app = tk.Tk()
class Excel(tk.Frame):
def __init__(self, master, rows, columns, width):
super().__init__(master)
for i in range(columns):
@jvoytech
jvoytech / fstring_test.py
Created January 25, 2019 08:17
fun with python f-string
n = 0xffee
m = 1999888777
f = 1599.499899
n32 = 0xffeeddcc
n64 = 0xffeeddcc80402010
fstring =f'''
n = {n} (0x{n:X}), m = {m}, f = {f}
n64 = 0x{n64:X}, n32 = 0x{n32:X}
/*
How to print color text in terminal (Linux terminals, Putty, etc.)
"\e[31mI am red\e[0m" <- prints text in red
*/
#include <stdio.h>
#include <math.h>
const char* const ANSI_RED = "\033[31m";