Skip to content

Instantly share code, notes, and snippets.

unsigned char* intToHex(int n, unsigned char* bytes){
int size = sizeof(bytes);
for(int i=0; i<size+1; i++){
size--;
bytes[i] = ( n >> (size * 8)) & 0xFF;
}
bytes[sizeof(bytes)-1] = n & 0xFF; // last
return bytes;
}
Due to the wrong format of cmake file
https://github.com/mfontanini/libtins/blob/master/cmake/Modules/FindPCAP.cmake
and current WpdPack folder structure (all folders start with a capital)
the only way to build libtins is to provide INCLUDE_DIR and -G option like that:
C:\Users\Sasha\GitHub\libtins\build>cmake ../ -DPCAP_ROOT-DIR=C:\WpdPack -DPCAP_
INCLUDE_DIR=C:\WpdPack\Include -DLIBTINS_ENABLE_WPA2=0 -DLIBS_BUILD_SHARED=0 -G
"MinGW Makefiles"
@bytepicker
bytepicker / gist:436e2ac079fa373084f2
Created December 9, 2015 19:11
Makefile for libtwitcurl on Mac OS X
# Hey Emacs, this is a -*- makefile -*-
# The twitcurl library.. a Makefile for OpenWRT
# Makefile-fu by John Boiles
# 28 September 2009
LIBNAME = twitcurl
SRC = $(LIBNAME).cpp
STAGING_DIR =
INCLUDE_DIR = $(STAGING_DIR)/usr/include
LINCLUDE_DIR = $(STAGING_DIR)/usr/local/include
@bytepicker
bytepicker / w.sh
Created December 4, 2015 18:01
warning
pcap.c:54:18: warning: incompatible pointer types passing 'FILE *' (aka 'struct __sFILE *') to
parameter of type 'const char *' [-Wincompatible-pointer-types]
{ printf(stdout,"(IP)\n");}
^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/stdio.h:217:16: note:
expanded from macro 'stdout'
#define stdout __stdoutp
^~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/stdio.h:259:36: note:
passing argument to parameter here
/******************************
* floppy plays the beginning
* of the Imperial March
******************************/
#include <fstream>
#include <windows.h>
#include <iostream>
#include <string>
using namespace std;
@bytepicker
bytepicker / type.cpp
Created December 1, 2015 10:37
small type analog
#include <iostream>
#include <fstream>
#include <string.h> // strcat
using namespace std;
int main(){
char name[100];
char ch;
<?php
$url = 'https://api.vk.com/method/wall.get?owner_id=183123381&count=1&filter="owner"';
$jsonFile = file_get_contents($url);
// convert the string to a json object
$jfo = json_decode($jsonFile, true);
$textWall = $jfo['response'][1]['text'];
// get number of poems
$numCount = $jfo['response'][0];
$randOffset = rand(1,$numCount-1);
// now get random poem
@bytepicker
bytepicker / gist:af34f637aceff67b9fb7
Created February 14, 2015 18:54
Mac OS 10.10.2 + Ruby on Rails
ruby 2.1.5p273 + Rails 4.2.0 + Homebrew 0.9.5
If you follow the guide from https://gorails.com/setup/osx/10.10-yosemite or similar
and get the nokogiri error like:
$ rails new myapp
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----