Skip to content

Instantly share code, notes, and snippets.

View neuro-sys's full-sized avatar
💭
💾

Fırat Salgür neuro-sys

💭
💾
View GitHub Profile
#include <allegro.h>
#include <stdio.h>
#define V_DIST 100
#define FAR_Z 1000
#define NEAR_Z 20
typedef struct VECTOR3D_TYP {
union {
@neuro-sys
neuro-sys / LCD.asm
Created November 19, 2011 02:33
LCD HD44780 PIC
; PORTC is connected to D4:D7 as C0:C3
; PORTA is connected to RS/RW/E as A0/A1/A2
#include p16f690.inc
PROCESSOR p16f690
__CONFIG _INTRC_OSC_NOCLKOUT&_FCMEN_ON&_IESO_ON&_BOR_ON&_CPD_OFF&_CP_OFF&_MCLRE_OFF&_PWRTE_OFF&_WDT_OFF
RS EQU 5
RW EQU 1
E EQU 2
@neuro-sys
neuro-sys / param_pass.asm
Created November 19, 2011 21:52
passing function pointer in PIC
temp EQU 0x20
movlw HIGH Text1
movwf PCLATH
movlw LOW Text1
movwf temp
call LCD_String
movlw HIGH Text2
@neuro-sys
neuro-sys / pic_sound.asm
Created November 20, 2011 19:17
PIC16F690 star wars imperial march PWM with interrupts. Connect the output pin to a floppy drive, or a printer, or a scanner, you name it for fun.
#INCLUDE p16f690.inc
PROCESSOR P16F690
__CONFIG _INTRC_OSC_NOCLKOUT&_FCMEN_ON&_IESO_ON&_BOR_ON&_CPD_OFF&_CP_OFF&_MCLRE_OFF&_PWRTE_OFF&_WDT_OFF
ERRORLEVEL -302 ; SUPRESS BANK WARNING.
RADIX DEC
CBLOCK 0x20 ; RAM AREA
PULSE_TEMP ; PULSE FREQUENCY ALTERNATING FLAG
@neuro-sys
neuro-sys / twister.c
Created November 24, 2011 18:43
oldschool twister effect
#include <stdio.h>
#include <math.h>
#include <SDL/SDL.h>
#define LOCK_SURFACE(A) if (SDL_MUSTLOCK(A)) if (SDL_LockSurface(A) < 0) { printf("%s\n", SDL_GetError()); exit(1); }
#define UNLOCK_SURFACE(A) if (SDL_MUSTLOCK(A)) SDL_UnlockSurface(A);
#define ANGLE(A) (A) * M_PI / 180.
#define W 320
@neuro-sys
neuro-sys / pacman_disowned.sh
Created November 28, 2011 11:28
pacman disowned
#!/bin/sh
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
db=$tmp/db
fs=$tmp/fs
mkdir "$tmp"
trap 'rm -rf "$tmp"' EXIT
pacman -Qlq | sort -u > "$db"
@neuro-sys
neuro-sys / temporal_locality_blocking.c
Created March 26, 2012 04:29
Locality of reference - Temporal locality with loop tiling.
#include <stdio.h>
#include <time.h>
#define N 1000
#define R 125
int A[N][N], B[N][N], C[N][N];
void init_rand_matrix(int M[N][N])
@neuro-sys
neuro-sys / dwmconfig.h
Last active September 27, 2023 18:20
dwm volume control
/**
* config.h
* ALT + F11 | F12
*/
static const char *upvol[] = { "amixer", "set", "Master", "3+", NULL };
static const char *downvol[] = { "amixer", "set", "Master", "3-", NULL };
static const char *mutevol[] = { "amixer", "set", "Master", "toggle", NULL };
static Key keys[] = {
@neuro-sys
neuro-sys / Deepcopy.java
Created September 28, 2012 07:00
Deep copy Java
public class Deepcopy {
public static Object deepClone(Object value) throws IOException, ClassNotFoundException{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(value);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
ObjectInputStream ois = new ObjectInputStream(bais);
Object deepCopy = ois.readObject();
return deepCopy;
}
$TTL 86400
codedumpster.com. IN SOA ns1.codedumpster.com. root.codedumpster.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
86400 ) ; Negative Cache TTL
;
IN NS ns1