Skip to content

Instantly share code, notes, and snippets.

View salty-godzilla's full-sized avatar

jp.owo.Manda salty-godzilla

View GitHub Profile
@jvranish
jvranish / stack_traces.c
Last active July 15, 2024 16:39
An example of catching exceptions and printing stack traces in C on Windows, Linux and OS X
/* compile with:
on linux: gcc -g stack_traces.c
on OS X: gcc -g -fno-pie stack_traces.c
on windows: gcc -g stack_traces.c -limagehlp
*/
#include <signal.h>
#include <stdio.h>
#include <assert.h>
@santoshachari
santoshachari / Laravel PHP7 LEMP AWS.md
Last active February 20, 2024 10:00
Laravel 5.x on Ubuntu 16.x, PHP 7.x, Nginx 1.9.x

#Steps to install latest Laravel, LEMP on AWS Ubuntu 16.4 version. This tutorial is the improvised verision of this tutorial on Digitalocean based on my experience.

Install PHP 7 on Ubuntu

Run the following commands in sequence.

sudo apt-get install -y language-pack-en-base
sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install zip unzip
@dvidsilva
dvidsilva / fbtoform.js
Last active May 10, 2021 08:55
HTMLForm to Firebase sample
(function(){
var newscript = document.createElement('script');
newscript.type = 'text/javascript';
newscript.async = true;
newscript.src = 'https://www.gstatic.com/firebasejs/3.0.2/firebase.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);
})();
_setFormData = function setFormData (sel, data) {
console.info('setting form to data', data);
@Miouyouyou
Miouyouyou / init_window.c
Created December 15, 2016 07:55
A very ugly Wayland EGL OpenGL example
// gcc -o test init_window.c -I. -lwayland-client -lwayland-server -lwayland-client-protocol -lwayland-egl -lEGL -lGLESv2
#include <wayland-client.h>
#include <wayland-server.h>
#include <wayland-client-protocol.h>
#include <wayland-egl.h> // Wayland EGL MUST be included before EGL headers
#include "init_window.h"
#include "log.h"
#include <string.h>
@zlash
zlash / main.cpp
Created February 19, 2017 04:57
Minimal bgfx + SDL2
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
#include <bgfx/bgfx.h>
#include <bgfx/platform.h>
#include <bx/bx.h>
#include <bx/mutex.h>
#include <bx/thread.h>
void threadInit()
{
@RavuAlHemio
RavuAlHemio / mds2midi.py
Last active April 12, 2024 00:05
MDS to standard MIDI file converter
#!/usr/bin/env python3
#
# MDS to standard MIDI file converter
#
# see also http://www.vgmpf.com/Wiki/index.php?title=MDS
#
import argparse
import io
import struct
from typing import BinaryIO, List, Optional
@garasubo
garasubo / xim_example.c
Created January 25, 2020 05:14
Example code to use preedit callbacks in XIM
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <assert.h>
Display *dpy;
Window win;
@Pokechu22
Pokechu22 / applyEntityCollision.java
Last active June 26, 2022 18:29
Minecraft entity collision logic (simplified)
public class Entity {
public void applyEntityCollision(Entity other) {
double dx = other.posX - this.posX;
double dz = other.posZ - this.posZ;
double largestDistance = Math.max(Math.abs(dx), Math.abs(dz));
if (largestDistance >= 0.01) {
double vx = dx / 20;
double vz = dz / 20;
if (largestDistance < 1) {
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active September 11, 2023 10:21
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to