Skip to content

Instantly share code, notes, and snippets.

View indywidualny's full-sized avatar

Krzysztof Grabowski indywidualny

View GitHub Profile
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
@indywidualny
indywidualny / MainActivity.java
Created May 22, 2015 05:00
saxrssreader working example, AsyncTask
package org.indywidualni.test;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import java.net.URL;
import java.util.ArrayList;
import nl.matshofman.saxrssreader.RssFeed;
import nl.matshofman.saxrssreader.RssItem;
@indywidualny
indywidualny / strings-en.xml
Last active August 29, 2015 14:23
fNotifier: Strings for translation
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">fNotifier</string>
<string name="settings">Settings</string>
<string name="author" translatable="false">Krzysztof \'Koras\' Grabowski</string>
<string name="indywidualni" translatable="false">Indywidualni.org</string>
<string name="email_author">Contact me</string>
<string name="choose_email_client">Choose e-mail client</string>
<string name="google_play" translatable="false">Google Play</string>
@indywidualny
indywidualny / st_Test.java
Created June 26, 2015 10:43
Programowanie 2 - Egzamin
interface Email{ //( 1)
public String getFrom(); //( 2)
public String getMessage(); //( 3)
} //( 4)
// ############################################## //( 5)
class TextEmail implements Email{ //( 6)
private String from, message; //( 7)
public TextEmail(String from, String message){ //( 8)
this.from = from; //( 9)
this.message = message; //(10)
@indywidualny
indywidualny / dhcpcd.conf
Last active October 14, 2020 19:26
/etc/dhcpcd.conf
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
hostname
# Use the hardware address of the interface for the Client ID.
#clientid
@indywidualny
indywidualny / Example.java
Last active November 14, 2015 03:21
URL decoder
// url decoder, recreate all the special characters
private static String urlDecode (String url) {
return url.replace("%3C", "<").replace("%3E", ">").replace("%23", "#").replace("%25", "%")
.replace("%7B", "{").replace("%7D", "}").replace("%7C", "|").replace("%5C", "\\")
.replace("%5E", "^").replace("%7E", "~").replace("%5B", "[").replace("%5D", "]")
.replace("%60", "`").replace("%3B", ";").replace("%2F", "/").replace("%3F", "?")
.replace("%3A", ":").replace("%40", "@").replace("%3D", "=").replace("%26", "&")
.replace("%24", "$").replace("%2B", "+").replace("%22", "\"").replace("%2C", ",")
.replace("%20", " ");
}
@indywidualny
indywidualny / Main.java
Created December 14, 2015 14:26
String to SHA-1
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Main {
public static void main(String[] args) {
String plain = "example";
System.out.println("Plain: " + plain);
try {
System.out.println("SHA-1: " + AeSimpleSHA1.SHA1(plain));
@indywidualny
indywidualny / commands.sh
Last active January 30, 2017 00:20
Let's encrypt @ nginx
vim /etc/nginx/nginx.conf
...
server {
...
location ^~ /.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
}
...
@indywidualny
indywidualny / restore.sh
Last active December 11, 2018 12:25
Access GitLab repositories directly from GitLab backup (without GitLab installation)
➜ ls
1544526681_2018_12_11_11.4.5_gitlab_backup.tar
➜ tar -xvf 1544526681_2018_12_11_12.2.1_gitlab_backup.tar
# Unpacking...
➜ ls
1544526681_2018_12_11_12.2.1_gitlab_backup.tar builds.tar.gz pages.tar.gz
artifacts.tar.gz db repositories
backup_information.yml lfs.tar.gz uploads.tar.gz
➜ cd repositories/example
➜ git clone example.wiki.bundle