Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
@pinebit
pinebit / How-To-Play-MIDI-WIN32.c
Last active September 8, 2023 06:34
Playing MIDI using raw WIN32 API
// Step 1. Open default MIDI-device or die
int rc = midiOutOpen(&midi_device, 0, 0, 0, CALLBACK_NULL);
if (rc != MMSYSERR_NOERROR) {
return FALSE;
}
// Step 2. Set instrument for a channel (0..15)
DWORD command = (0x000000C0 | CHANNEL) | (INSTRUMENT << 8);
midiOutShortMsg(midi_device, command);
@slime73
slime73 / sdl-metal-example.m
Last active September 9, 2021 10:53
SDL + Metal example
/**
* This software is in the public domain. Where that dedication is not recognized,
* you are granted a perpetual, irrevokable license to copy and modify this file
* as you see fit.
*
* Requires SDL 2.0.4.
* Devices that do not support Metal are not handled currently.
**/
#import <UIKit/UIKit.h>
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 6, 2024 02:17
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@sangeeths
sangeeths / github-to-bitbucket
Created March 10, 2014 15:24
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
package main
import (
"encoding/json"
"flag"
"io/ioutil"
"launchpad.net/xmlpath"
"log"
"net/http"
"strconv"
@acturcato
acturcato / ACT_WEATHER.ino
Last active December 22, 2022 04:38
Web Client to consume Weather Underground web service (RESTful and JSON formats). This sketch connects to a website (http://api.wunderground.com) using an Arduino + Ethernet shield and get data from site. Circuit: * Arduino MEGA 2560 R3 Board. * Ethernet shield attached to pins 10, 11, 12, 13. Created 07 Jan 2014 by Afonso C. Turcato. Arduino ID…
/*
Web Client to consume Weather Underground web service
This sketch connects to a website (http://api.wunderground.com)
using an Arduino Ethernet shield and get data from site.
Circuit:
* Arduino MEGA 2560 R3 Board
* Ethernet shield attached to pins 10, 11, 12, 13
@pzurek
pzurek / Twelve_Go_Best_Practices.md
Last active March 16, 2024 14:19
Twelve Go Best Practices
@Tapchicoma
Tapchicoma / java-package-rename.sh
Created December 28, 2012 08:43
Rename java package name in command line
#!/bin/sh
find . -name *.java -print | xargs sed -i 's/old\.package\.name/new\.package\.name/g'
@tonyblundell
tonyblundell / ago.py
Created May 10, 2012 10:43
ago: Calculate a '3 hours ago' type string from a python datetime.
import datetime
def ago(t):
"""
Calculate a '3 hours ago' type string from a python datetime.
"""
units = {
'days': lambda diff: diff.days,
'hours': lambda diff: diff.seconds / 3600,
'minutes': lambda diff: diff.seconds % 3600 / 60,