Skip to content

Instantly share code, notes, and snippets.

@Wicowyn
Wicowyn / twitterParser.java
Created September 7, 2015 13:09
To parse twitter message
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* Created by yapiti on 07/09/15.
*/
public class Main {
@Wicowyn
Wicowyn / addImage.java
Created October 8, 2015 15:41
Add image to PDF with PDFBox-Android
try {
final File realDocument = new File(adapter.get(currentPage).getUriLocal().getPath());
final File copyDocument = File.createTempFile("pdf", "pdf");
IOUtils.copy(new FileInputStream(realDocument), new FileOutputStream(copyDocument));
PDDocument document = PDDocument.load(copyDocument);
PDPage page=document.getPage(document.getNumberOfPages() - 1);
ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
@Wicowyn
Wicowyn / oklm.git
Last active November 5, 2015 09:17
Git merge sans s'énerver
//Si modification de fichier en cours
git stash //Pour sauvegarder les modification en cours et remettre la branch propre
//un "git status" ne doit vous indiquer aucune modifications
git fetch --all //Pour synchro le dépot local avec le serveur
git merge master
//Si fichiers en conflit
//les ouvrirs, corriger le code
git add mon_fichier_en_conflit.yolo //marquer comme résolu
@Wicowyn
Wicowyn / click.java
Created December 19, 2015 14:30
Android - Java 7 / 8
//En Java 7
findViewById(R.id.mon_bouton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
maFonction();
}
});
//En Java 8 + Retrolambda
findViewById(R.id.mon_bouton).setOnClickListener(v -> maFonction());
@Wicowyn
Wicowyn / launch.sh
Created September 1, 2016 12:12
Tiny Tiny RSS as daemon
sudo start-stop-daemon --start --chuid www-data --background --exec /usr/bin/php -- /var/www/tt-rss/update_daemon2.php --feeds --quiet
@Wicowyn
Wicowyn / build.gradle
Created September 12, 2016 09:04
Gradle properties
#!bash
./gradlew -Pcoverage clean connectedDebugAndroidTest
#build.gradle
testCoverageEnabled (project.hasProperty('coverage') ? true : false)
@Wicowyn
Wicowyn / Dockerfile
Created September 13, 2016 12:27
monero node
FROM ubuntu:16.04
MAINTAINER Nicolas Barranger <[email protected]>
USER root
RUN mkdir /monero && cd /monero && mkdir data
RUN apt update && apt install -y wget ca-certificates openssl bzip2
WORKDIR /monero
RUN wget -O monero.tar.bz2 https://downloads.getmonero.org/linux64
@Wicowyn
Wicowyn / Main.java
Last active September 26, 2016 16:14
Java instance création
public class Main {
public static void main(String[] args) {
new SubClass();
}
}
@Wicowyn
Wicowyn / zcash.py
Created November 10, 2016 09:40
zcash miner on qrad
#!/usr/bin/env python
import sys
import qarnot
import os
import operator
# Edit 'samples.conf' to provide your own credentials
# Create a connection, from which all other objects will be derived
version: '2'
services:
dnscrypt:
image: gists/dnscrypt-proxy
restart: unless-stopped
container_name: dnscrypt
ports:
- "127.0.0.1:53:5353/udp"
- "127.0.0.1:53:5353/tcp"