Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
public class HelloWorld extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
Label label = new Label("Hello World");
@thinkphp
thinkphp / writeInt.java
Created November 23, 2018 19:04
write ints
import java.io.*;
class WriteInts
{
public static void main ( String[] args )
{
String fileName = "intData.dat" ;
int value0 = 0, value1 = 1, value255 = 255, valueM1 = -1;
public class Euclid {
//recursive implementation
public static int gcd(int x, int y) {
if( y == 0 ) return x;
else return gcd( y, x % y );
}
@thinkphp
thinkphp / coffeescript.html
Created November 17, 2018 18:38
CoffeScript in Browser
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>CoffeScript on browser</title>
</head>
<body>
<script type="text/coffeescript">
class Animal
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - \
&& sudo apt-get install -y nodejs
@thinkphp
thinkphp / hello_world.sh
Created November 4, 2018 18:32
This script will tell you your username and running the current processes.
#!/bin/bash
# My first script
echo "Hello $USER"
echo "Hey I am " $USER " and will be telling you about the current processes"
echo "Running processes list"
ps
@thinkphp
thinkphp / copy.c
Last active November 1, 2018 09:18
mv filename1 filename2
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
int main(int argc, int **argv) {
char ch;
FILE *source, *target;
char source_file[40], target_file[40];
@thinkphp
thinkphp / opendir.c
Created October 31, 2018 16:51
Reads the contents of a root directory
/**
This example reads the contents of a root directory.
Reference: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.bpxbd00/rtread.htm
*/
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
@thinkphp
thinkphp / fread.c
Created October 30, 2018 08:47
BubbleSort reading the data with fread() function from inFILE
/**
Author: Adrian Statescu <http://adrianstatescu.com>
How does fread really work?!
The declaration of FREAD is as following:
size_t fread(void *ptr, size_t size, size_t nmem, FILE *stream)
There may or may not be any difference in performance. There is a difference in semantics.
fread(a, 1, 1000, stdin); -> attempts to read 1000 data elements each of which is 1 byte long
fread(a, 1000, 1, stdin); -> attempts to read 1 data element which is 1000 bytes long
@thinkphp
thinkphp / Combsort.c
Created February 8, 2018 04:03
CombSort Algorithm using pointers to functions.
#include <stdio.h>
#include <malloc.h>
#define FIN "algsort.in"
typedef int (*Comparer)(int, int);
typedef void (*fnPtr)(int*, int, Comparer);
int sort_asc(int a, int b) {