Skip to content

Instantly share code, notes, and snippets.

View xShivan's full-sized avatar

Michał Cywiński xShivan

View GitHub Profile
@xShivan
xShivan / gist:ab76d8cb6627db12f18c
Created June 11, 2014 21:31
Obsługa ekranu LCD
#include <REGX52.H>
//Kod obslugi wyswietlacza z zajec
sbit LCD_D7 = P2^3;
sbit LCD_D6 = P2^2;
sbit LCD_D5 = P2^1;
sbit LCD_D4 = P2^0;
sbit LCD_RS = P2^4;
sbit LCD_RW = P2^5;
sbit LCD_E = P2^6;
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#define SIZE 128
#define KEY 1234
@xShivan
xShivan / gist:1e562cffec02c1c09f4f
Created June 9, 2014 19:58
Sending signals from signal handler
//Hold execution
void usr1()
{
printf("Received SIGUSR1 at PID %d\n", getpid());
if (pid_parent == getpid())
{
//Parent process
kill(pid_processor, SIGCONT);
kill(pid_output, SIGCONT);
}
@xShivan
xShivan / gist:56eca00f7350e94d346c
Created June 7, 2014 22:16
Problem z liczba znakow
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
short ok = 1;
//String buffer
char buffer[128];
@xShivan
xShivan / gist:15b5f05bc2d895b7101d
Last active August 29, 2015 14:02
Systemy operacyjne Lab 11
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
pthread_mutex_t mutex;
char buffer[32]; //32bit = 4 bytes; 4 bytes * 32 integers = 128 bytes long integer array
char source_filename[32];
char destination_filename[32];
FILE* working_copy;
FILE* destination_copy;
@xShivan
xShivan / gist:641586fcd8a7a3d4d546
Created May 28, 2014 16:48
Szachownica Laboratorium JTP
package rysowanie;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JComponent;
import javax.swing.JFrame;
class MyCanvas extends JComponent {
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
char text[32];
void* wyswietl(void* w)
{
if (w == 0) //Odwrotna kolejność
@xShivan
xShivan / gist:b13cd8788e9154bbe5f6
Last active August 29, 2015 14:01
Laboratorium SO6
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
char text[32];
void* wyswietl(void* w)
{
if (w == 0) //Odwrotna kolejność
@xShivan
xShivan / gist:6daf8e6a399d62b8b56d
Last active August 29, 2015 14:01
Laboratorium SO6 - Demo z zajęć
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
void* wyswietl(void* w)
{
int z;
printf("W przekazany do wąkku %d", (int)w);
z = (int)w + 10;
pthread_exit((void*)z);
@xShivan
xShivan / gist:46b5e682ca100c8f3dbe
Created May 14, 2014 00:56
Attatching values to form just before it is sent
$("#submit").click(function () {
var ids = "";
$(":checkbox").each(function () {
if ($(this).is(':checked')) {
ids = ids + $(this).val() + ";";
}
});
$("#mainform").append("<input type='hidden' value='" + ids + "' name='participant_ids' />");
});