Skip to content

Instantly share code, notes, and snippets.

View topnotcher's full-sized avatar

Greg Bowser topnotcher

  • Zebra Technologies
  • Lincoln, RI
View GitHub Profile
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5feec0de-7db6-40c4-b478-2ec1e378eaac' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct {
uint8_t b[6];
} bdaddr_t;
#if defined(LINUX)
import socket
import asyncio
import fcntl
from ctypes import BigEndianStructure, Structure, c_uint16, c_uint8, c_char, c_uint32, sizeof, c_int
from purplehaze.bluetooth import BluetoothManager
SOL_L2CAP = 6
L2CAP_OPTIONS = 0x01
import enum
_ops = ['LDI', 'DUP', 'SWAP', 'POP',
'ADD', 'SUB', 'MUL', 'DIV', 'MOD',
'LD', 'STR',
'LABEL', 'CALL', 'JMP', 'JZ', 'JNEG', 'RET', 'EXIT',
'OCHR', 'OINT', 'ICHR', 'IINT',
]
OP = enum.Enum('OPS', _ops)

Background on stdcall

  • eax, ecx, edx are clobbered
  • return through eax
  • Caller allocates stack space
  • arguments pushed right to left (i.e. the first argument has a lower address)
  • callee expected to deallocate stack space

stdcall example

require 'net/http'
require 'json'
class Hue
@@key = '9da762a1b709cc5979778f37c623b452'
@@hue = 'http://192.168.1.152/api'
def initialize
end
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
int result;
int size;
int numbers[];
} calc_t;
def fucking_weather(m,where,temp)
tmp = temp.to_i
if tmp < -15
m.reply "IT DOES NOT FUCKING COMPUTE!"
elsif tmp < 0
m.reply "FUCKING STAY INSIDE!"
elsif tmp < 10
m.reply "IT'S FUCKING SUPER DREADFULLY FREEZING!"
elsif tmp < 20
m.reply "IT'S FUCKING FREEZING!!!"
CWInterface *interface = [CWInterface interfaceWithName:[[CWInterface interfaceNames] anyObject]];
CWMutableConfiguration *config = [CWMutableConfiguration configurationWithConfiguration:interface.configuration];
NSMutableArray *networks = [NSMutableArray arrayWithArray:[config.networkProfiles array]];
for (CWNetworkProfile *profile in [networks copy]) {
if ([[profile ssid] isEqualToString:@"URI_Open"]) {
[networks removeObject:profile];
} else if ([[profile ssid] isEqualToString:@"URI_Secure"]) {
CWNetworkProfile *tmp = profile;
[networks removeObject:tmp];
#SUBSYSTEM!="usb_device", ACTION!="add", GOTO="avrisp_end"
#AVRISP mkII
SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2104", MODE="0660", GROUP="users"
#JTAGICE3
SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2110", MODE="0660", GROUP="users", SYMLINK+="avrjtag"
#JTAGICE3 - after I updated firmware???