Skip to content

Instantly share code, notes, and snippets.

@briankip
briankip / binwalk.md
Last active March 2, 2024 13:25
A short introduction to binwalk

Binwalk

Binwalk is a simple linux tool for analysing binary files for embeded files and executable code. It is mostly used to extract the content of firmware images.

Installation

On kali linux, binwalk is already installed. On ubuntu you can do apt-get install binwalk or you can go to https://github.com/devttys0/binwalk and follow the instructions.

Usage

@briankip
briankip / phpunit-assertions.md
Last active February 9, 2024 18:42
A list of PHPUnit assertions
  • assertArrayHasKey
  • assertArrayNotHasKey
  • assertContains
  • assertAttributeContains
  • assertNotContains
  • assertAttributeNotContains
  • assertContainsOnly
  • assertAttributeContainsOnly
  • assertNotContainsOnly
  • assertAttributeNotContainsOnly
@briankip
briankip / linkgitcode.md
Last active February 2, 2024 13:10
Linking to lines or chunks of code on github.

So you want to link to a line or chunk of code this is how you do it.

  1. Go to the file you are talking about, if you are viewing a number of files click to view the specific file.
  2. To select one line go to the gutter (where the line numbers are) and click the number, it will highlight in yellow.
  3. For multiple lines select the starting line as above then select shift click the end line. It will highlight the entire chuck of code.
  4. The URL will have automatically changed if you noticed, but this is not the canonical URL as when commits continue and the line numbers shift do to addition of code, sooner or later the URL will be pointing to something completely different.
  5. To prevent this hit Y and you will get the permanent canonical URL to the commit.
  6. Now the address bar has the permanent link to that chunk/line of code.
@briankip
briankip / interfacer.py
Last active December 26, 2023 06:10
Python program for continually reading data from serial port and dumping it to file
#/usr/bin/env python
#Supposed mapping of sysmex KX-21 results output http://www.medelexis.ch/plugins_doc/2.1.7/Sysmex_Laborger%C3%A4teanbindung/KX-21N%20Interface.pdf
import serial
import datetime
#variables
port='/dev/ttyS0';
baudrate='9600';
@briankip
briankip / SudokuSolve.cpp
Created May 4, 2015 12:53
PM Lee's C++ Sudoku Solver Souce Code.
#include "stdio.h"
int InBlock[81], InRow[81], InCol[81];
const int BLANK = 0;
const int ONES = 0x3fe; // Binary 1111111110
int Entry[81]; // Records entries 1-9 in the grid, as the corresponding bit set to 1
int Block[9], Row[9], Col[9]; // Each int is a 9-bit array
;************************** BLIS INTERFACE CLIENT CONFIGURATION FILE **********************************************
;This is the main configuration file for C4G BLIS Interface Client.
;BLIS Interface Client is a very lightweight client for Interfacing BLIS with external systems using Protocols like
;RS232 Serial Port,TCP/IP, HTTP
;
;
; C4G BLIS Equipment Interface Client
;
; Project funded by PEPFAR
;
@briankip
briankip / Pluralizer.php
Last active July 4, 2017 13:26
from Illuminate\Support
<?php
use Doctrine\Common\Inflector\Inflector;
class Pluralizer
{
/**
* Uncountable word forms.
*
* @var array
int main()
{
char *str = "blablabla";
char c = 'H';
size_t len = strlen(str);
char *str2 = malloc(len + 1 + 1 ); /* one for extra char, one for trailing zero */
strcpy(str2, str);
str2[len] = c;
str2[len + 1] = '\0';
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<unistd.h>
#define QUEUE 1 //Queue for incoming connections
#define BUFFLENGTH 512 //Send buffer length
@briankip
briankip / myftpc.c
Last active October 7, 2015 04:51
client
#include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>