Skip to content

Instantly share code, notes, and snippets.

@FedericoPonzi
FedericoPonzi / FileReverse.c
Last active August 29, 2015 14:07
Reverse in c.
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
FILE *in_file;
char ch;
int len;
@FedericoPonzi
FedericoPonzi / win32api-reverse.c
Last active August 29, 2015 14:07
File reverser usando le win32api
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
char s; //buffer
HANDLE file; //Handle del file
@FedericoPonzi
FedericoPonzi / win32api-simplels.c
Last active August 29, 2015 14:07
This is a simple ls version using the win32api.
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <direct.h>
int main(int argc, char **argv)
{
HANDLE handleFind;
WIN32_FIND_DATA findFileData;
char *dir;
@FedericoPonzi
FedericoPonzi / win32api-create-and-write.c
Created October 17, 2014 13:46
Create and write inside a file using the Win32api in C.
#include <windows.h>
#include <stdio.h>
int main(int argc, CHAR *argv[])
{
HANDLE hFile;
char DataBuffer[] = "This ia s test string to be written.";
DWORD dwBytesToWrite = (DWORD) strlen(DataBuffer);
DWORD dwBytesWritten = 0;
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%!
private Cookie getCookie(String name, Cookie[] cookies)
{
for(Cookie cookie: cookies)
{
if(cookie.getName().equals(name))
return cookie;
}
@FedericoPonzi
FedericoPonzi / signal.c
Last active September 10, 2015 18:44 — forked from aspyct/signal.c
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* a.dotreppe@aspyct.org
* http://aspyct.org
* @aspyct (twitter)
*
* Hope it helps :)
*/
#include <stdio.h>
@FedericoPonzi
FedericoPonzi / tmux-cheatsheet.markdown
Created October 8, 2015 13:10 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@FedericoPonzi
FedericoPonzi / buffer-overflow-example.c
Created March 1, 2015 15:30
A buffer overflow example. Check an example on how to exploit this program: https://youtu.be/1I_zu37YJFI
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
char greeting[] = "Hello there\n1. Receive wisdom\n2. Add wisdom\nSelection >";
char prompt[] = "Enter some wisdom\n";
@FedericoPonzi
FedericoPonzi / FibonacciClosure.go
Created December 17, 2015 10:32
Fibonacci closure made in GOlang
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
nMeno1 := 0
nMeno2 := 1
return func() int {
@FedericoPonzi
FedericoPonzi / ArraySum.go
Created December 18, 2015 10:33
Sum of the elements of an array using multithreading and dividi et impera in Golang.
package main
import "fmt"
func dividiEtImpera( arr []int, low int, hi int, ch chan int){
if hi - low == 1{
// fmt.Println("low: ", low, " hi:", hi, " Caso hi-low==1, ritorno:",arr[hi-1], "+", arr[low]
ch <- arr[hi-1] + arr[low]
} else if hi-low == 0{