Skip to content

Instantly share code, notes, and snippets.

View jrasanen's full-sized avatar
🦁

Jussi Räsänen jrasanen

🦁
  • Internet
View GitHub Profile
@YukiSnowy
YukiSnowy / main.cpp
Last active October 8, 2023 13:56
example SDL2 Direct3D9 application
// g++ *.cpp -o d3d9 -lmingw32 -lSDL2main -lSDL2 -I/dxsdk/include -L/dxsdk/lib -DUNICODE -ld3d9 -ld3dx9
// http://blog.fourthwoods.com/2011/08/11/setting-up-mingw-for-directx/
// http://www.directxtutorial.com/Lesson.aspx?lessonid=9-4-4
#include <iostream>
using namespace std;
#include <SDL2/SDL.h>
#include <windows.h>
@jrasanen
jrasanen / s3-individual-bucket.json
Created October 8, 2015 09:53
How to give permission to an individual S3 bucket (IAM policy)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1442911835000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
@urraka
urraka / stb.c
Last active January 21, 2024 00:20
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#define STBI_ONLY_PNG
#define STBI_ONLY_JPEG
#define STBI_ONLY_BMP
#define STBI_ONLY_GIF
#include "stb_image.h"
#include "stb_image_write.h"
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active December 12, 2023 17:47
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@voter101
voter101 / Gulpfile.js
Last active November 29, 2021 01:17
Gulpfile for Rails application with replaced Sprockets with Gulp
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
module PayPal::SDK
module REST
module DataTypes
Payer.class_eval do
object_of :merchant_id, String
end
class ChargeModel < Base
object_of :id, String
object_of :type, String
@Kartones
Kartones / postgres-cheatsheet.md
Last active April 12, 2024 17:44
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@simonista
simonista / .vimrc
Last active April 18, 2024 06:11
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active February 25, 2024 13:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@madwork
madwork / attachment.rb
Last active July 25, 2021 09:13
Polymorphic attachments with CarrierWave and nested_attributes
class Attachment < ActiveRecord::Base
mount_uploader :attachment, AttachmentUploader
# Associations
belongs_to :attached_item, polymorphic: true
# Validations
validates_presence_of :attachment