Skip to content

Instantly share code, notes, and snippets.

View Shujito's full-sized avatar
🗿
yes the whole earth

Alberto Ramos Shujito

🗿
yes the whole earth
View GitHub Profile
@Shujito
Shujito / http.java
Last active August 29, 2015 13:57
ejemplo HttpURLConnection, le faltan try catches
// nueva conexion
URL url = new URL("http://danbooru.donmai.us/posts.json?tags=setz");
// abrir
HttpURLConnection https = (HttpURLConnection) url.openConnection();
// conectar
https.connect();
// 200,401,404,500
int code = https.getResponseCode();
// OK, Access denied, Not found, Internal server error
String message = https.getResponseMessage();
/**
* Estrategia de exclusion para {@link Gson} para saltarse campos que no sean serializables
* @author shujito
*/
public class ExcludeFieldsWithoutSerializedName implements ExclusionStrategy
{
@Override
public boolean shouldSkipClass(Class<?> clss)
{
return false;
@Shujito
Shujito / anoter-idea.lua
Last active September 2, 2016 17:50
This is an idea I have
local STATE_SELECT_SONG = 0
local STATE_SELECT_CHART = 1
local STATE_CONFIRM = 2
local function makeBackgroundOrnaments(self)
-- TODO
end
local function makeForegroundOrnaments(self)
-- TODO
end
@Shujito
Shujito / things.java
Created February 18, 2016 15:17
some notes
byte[][] combinations = {
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
List<Long> crcList = new ArrayList<>();
for (byte[] combination : combinations) {
crcList.add(this.crc32(combination));
}
Log.i(TAG, "combos:" + crcList);
/**
* <p>Title screen, it shows the logo. Makes player join by pressing its center button.
*
* @author shujito
*/
public class ScreenTitle extends Screen {
public static final String TAG = ScreenTitle.class.getSimpleName();
private final Music mSndBgm;
private final Music mSndStart;
private final Sprite tap;
@Shujito
Shujito / recurse.lua
Created March 2, 2016 17:55
Recurse a lua table
local function recurse(t,lvl)
lvl = lvl or 0
for k,v in pairs(t) do
print( string.rep(' ',lvl) .. k)
if type(v) == 'table' then
recurse(v,lvl+1)
else
print( string.rep(' ',lvl) .. ' ' .. type(v) .. ':')
print( string.rep(' ',lvl) .. ' ' .. tostring(v))
end
@Shujito
Shujito / configuration.sh
Last active November 8, 2016 19:46
useful stuff for servers
# basic debian vps setup (configurations and security)
#################
## root config ##
# change root password
passwd
# fix locales (e.g. "Setting locale failed" messages)
locale-gen en_US.UTF-8
dpkg-reconfigure locales
@Shujito
Shujito / imgurer.lua
Created November 15, 2016 07:09
imgur permutator
local fiveChars = ... or 'weiss'
--print('chars:', fiveChars:lower())
local function bitSet(number, offset)
local nro = bit32.rshift(number, offset)
local nroa1 = bit32.band(nro, 1)
--print('nroa1', nroa1)
return nroa1 ~= 0
end
@Shujito
Shujito / spotihosts
Last active November 29, 2023 06:56
The hosts file entries to block Spotify audio ad servers.
# taken from here:
# https://www.reddit.com/r/Piracy/comments/4kn6rq/comprehensive_guide_to_blocking_ads_on_spotify/
0.0.0.0 adclick.g.doublecklick.net
0.0.0.0 adeventtracker.spotify.com
0.0.0.0 ads-fa.spotify.com
0.0.0.0 analytics.spotify.com
0.0.0.0 audio2.spotify.com
0.0.0.0 b.scorecardresearch.com
0.0.0.0 bounceexchange.com
0.0.0.0 bs.serving-sys.com
@Shujito
Shujito / bookmarklets.md
Last active February 9, 2024 21:37
Useful bookmarklets

Useful Bookmarklets

How to use:

Create a bookmark and replace URL with either of the listed codes

Easier: (google chrome)

  • Triple click to the whole thing
  • COPY!
  • Now hit [CTRL] + [D]