Skip to content

Instantly share code, notes, and snippets.

View six519's full-sized avatar

Ferdinand E. Silva six519

View GitHub Profile
@six519
six519 / kill2.asm
Created July 23, 2020 23:31
Terminate a process using a system call in Linux
;usage: ./kill2 <PID>
;same as `kill -n 9 <PID>` command in Linux
;just practicing programming in assembly language (Ferdinand Silva)
section .data
SYS_EXIT: equ 60
SYS_KILL: equ 62
SYS_WRITE: equ 1
SIGKILL: equ 9
STD_IN: equ 1
INVALID: db "Usage: kill2 <PID>", 10
@six519
six519 / test.go
Created August 7, 2019 01:47
Google Cloud Vision (Golang)
package main
import (
"fmt"
"os"
"bufio"
"encoding/base64"
"encoding/json"
"net/http"
"bytes"
@six519
six519 / town_of_salem.py
Last active May 14, 2019 09:25
Town of Salem Echo And Auto Greeter Bot
#!/usr/bin/env python
"""
Note:
-----
* Install pycrypto
"""
import socket
import re
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_PKCS1_v1_5
@six519
six519 / test.asm
Created January 1, 2019 11:27
My Hello World Code In Assembly Language On Mac OS X
; Assembling and linking
; ----------------------
; nasm -f macho64 test.asm
; gcc -o test test.o -Wl,-no_pie
section .data ; data section
line1:
db "My name is: " ; constant string
line2:
db "Ferdinand", 0xA ; constant string with newline
@six519
six519 / test.go
Last active November 6, 2018 10:14
Windows API Implementation In Go Sample Code (Change Console Text Color)
package main
import (
"fmt"
"syscall"
"unsafe"
)
const (
FOREGROUND_BLACK uint16 = 0x0000
@six519
six519 / test.py
Created July 14, 2018 06:35
A6 GSM/GPRS Module Autoresponder (Auto Reply) Sample Code In Python
#!/usr/bin/env python
import serial
import time
import re
if __name__ == "__main__":
ser = serial.Serial('/dev/cu.SLAB_USBtoUART', 9600, timeout=1)
isOk = False
try:
@six519
six519 / main.go
Last active July 25, 2018 12:36
Evaluate Reverse Polish Notation & Shunting-yard Algorithm Sample Code (Golang)
package main
import (
"fmt"
"bufio"
"os"
"errors"
"unicode"
"strconv"
)
@six519
six519 / test.c
Created April 27, 2018 00:53
Ang Bayan Kong Sinilangan Tune With Arduino In Pure C (Passive Buzzer)
/*
Thanks to this post: https://balau82.wordpress.com/2014/10/15/using-a-buzzer-with-arduino-in-pure-c/
*/
#ifndef F_CPU
#define F_CPU 16000000UL //set frequency
#endif
#define __DELAY_BACKWARD_COMPATIBLE__
#include <avr/io.h>
@six519
six519 / test.c
Created April 22, 2018 07:30
Pure C Language In Arduino Uno (Sample Code 3) [Digital Read]
/*
Compiling and uploading to Arduino Uno (Sample Code 3) [Digital Read]
=====================================================================
avr-gcc -Os -mmcu=atmega328p -c test.c
avr-gcc -mmcu=atmega328p -o test.elf test.o
avr-objcopy -O ihex -R .eeprom test.elf test.hex
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/cu.usbmodem1421 -b 115200 -U flash:w:test.hex
*/
@six519
six519 / test.c
Created April 22, 2018 01:08
Pure C Language In Arduino Uno (Sample Code 2)
/*
Compiling and uploading to Arduino Uno (Sample Code 2)
======================================================
avr-gcc -Os -mmcu=atmega328p -c test.c
avr-gcc -mmcu=atmega328p -o test.elf test.o
avr-objcopy -O ihex -R .eeprom test.elf test.hex
avrdude -F -V -c arduino -p ATMEGA328P -P /dev/cu.usbmodem1421 -b 115200 -U flash:w:test.hex
*/