Skip to content

Instantly share code, notes, and snippets.

View thecocce's full-sized avatar

TheCocce thecocce

View GitHub Profile
// SOURCE
// http://techblog.orangepixel.net/2015/07/shine-a-light-on-it/
// http://www.java-gaming.org/topics/2d-nuclear-throne-style-lighting-libgdx/38314/view.html
// VARS
FrameBuffer lightBuffer;
TextureRegion lightBufferRegion;
SpriteBatch light_batch;
// RENDER LOOP
@thecocce
thecocce / mysql-cumulative-sum.sql
Created July 11, 2018 08:39 — forked from MagePsycho/mysql-cumulative-sum.sql
MySQL: Running Total (Cumulative Sum)
-- without using SET variable
SELECT t.id,
t.count,
(@running_total := @running_total + t.count) AS cumulative_sum
FROM TABLE t
JOIN (SELECT @running_total := 0) r
ORDER BY t.id
-- with SET variable
SET @running_total := 0;
@thecocce
thecocce / MySqlBackup.bat
Created March 14, 2018 15:23 — forked from adityasatrio/MySqlBackup.bat
Mysql Backup Script For Windows
@echo off
set dbUser=root
set dbPassword=password
set backupDir="F:\AdityaSatrioNugroho\testbackupDb-bat\"
set mysqldump="C:\xampp\mysql\bin\mysqldump.exe"
set mysqlDataDir="C:\xampp\mysql\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date
@thecocce
thecocce / build.ps1
Created December 21, 2017 07:35 — forked from mantis/build.ps1
Windows Build File for admin-on-rest
<#
.SYNOPSIS
Manages the build of admin-on-rest on windows
.DESCRIPTION
This powershell script attempts to implement the linux makefile for admin-on-rest for those users who may wish to
develop the system on a windows based operating system.
Examples:
1) To install required modules
./make.ps1 -install
@thecocce
thecocce / CleanCode-it.md
Created September 29, 2017 22:26 — forked from ValentinaServile/CleanCode-it.md
Appunti sui principi del Clean Code

Clean Code ITA

Nomi

  • Tutte le variabili, costanti, funzioni, classi etc devono avere un nome significativo. Se il nome ha bisogno di un commento per essere spiegato non è abbastanza significativo.

  • Sono da evitare nomi che possano sviare dal vero significato della variabile

@thecocce
thecocce / CharArrayWriterResponse.java
Created July 27, 2017 07:10 — forked from valotas/CharArrayWriterResponse.java
Get the output of an the web container as string
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
public class CharArrayWriterResponse extends HttpServletResponseWrapper {
private final CharArrayWriter charArray = new CharArrayWriter();
@thecocce
thecocce / GLSL-Noise.md
Created April 29, 2017 07:12 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@thecocce
thecocce / jsonToSqlite.py
Created February 27, 2017 11:09 — forked from atsuya046/jsonToSqlite.py
create sqlite database file from json file
# -*- coding:utf-8 -*-
import json
import sqlite3
JSON_FILE = "some.json"
DB_FILE = "some.db"
traffic = json.load(open(JSON_FILE))
conn = sqlite3.connect(DB_FILE)
@thecocce
thecocce / mysql2sqlite.sh
Created February 14, 2017 15:16 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@thecocce
thecocce / fix-xcode
Created January 4, 2017 09:32 — forked from rnapier/fix-xcode
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs: