Skip to content

Instantly share code, notes, and snippets.

Avatar

Krzysztof Grabowski indywidualny

View GitHub Profile
@indywidualny
indywidualny / restore.sh
Last active Dec 11, 2018
Access GitLab repositories directly from GitLab backup (without GitLab installation)
View restore.sh
➜ 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
@indywidualny
indywidualny / commands.sh
Last active Jan 30, 2017
Let's encrypt @ nginx
View commands.sh
vim /etc/nginx/nginx.conf
...
server {
...
location ^~ /.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
}
...
View Main.java
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));
View Example.java
// 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 / dhcpcd.conf
Last active Oct 14, 2020
/etc/dhcpcd.conf
View 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 / st_Test.java
Created Jun 26, 2015
Programowanie 2 - Egzamin
View st_Test.java
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 / strings-en.xml
Last active Aug 29, 2015
fNotifier: Strings for translation
View strings-en.xml
<?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 / MainActivity.java
Created May 22, 2015
saxrssreader working example, AsyncTask
View MainActivity.java
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;
View Connectivity.java
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