Skip to content

Instantly share code, notes, and snippets.

View 3ffusi0on's full-sized avatar
🎯
Focusing

SIMON Pierre-Alain 3ffusi0on

🎯
Focusing
  • Freelance
  • France
View GitHub Profile
@3ffusi0on
3ffusi0on / MapCast.java
Created May 12, 2017 14:16
From Map<String, List<IChamp>> to Map<String, List<Champ>> (with Champ implements IChamp)
// From Map<String, List<IChamp>> to Map<String, List<Champ>> (with Champ implements IChamp)
Map<String, List<Champ>> champs = (Map<String, List<Champ>>) (Map<String, ?>) myClass.myMethode();
@3ffusi0on
3ffusi0on / activation_key.ps1
Last active April 20, 2017 17:32
Find Windows activation key
(Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey
@3ffusi0on
3ffusi0on / Multiline-TreeViewer.java
Created October 26, 2016 14:14
SWT Multiline TreeViewer with centered image (Limitation : https://bugs.eclipse.org/bugs/show_bug.cgi?id=154341)
tree.addListener(SWT.MeasureItem, paintListener);
tree.addListener(SWT.PaintItem, paintListener);
tree.addListener(SWT.EraseItem, paintListener);
Listener paintListener = new Listener() {
@Override
public void handleEvent(Event event) {
switch(event.type) {
case SWT.MeasureItem: {
TreeItem item = (TreeItem)event.item;
@3ffusi0on
3ffusi0on / SWT_Tabulation.java
Created July 20, 2016 08:27
Catch Tab key, don't print it and change it's action with SWT
new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
e.doit = false;
// Action
}
}
};
@3ffusi0on
3ffusi0on / setup.iss
Created February 14, 2016 16:33
Setup configuration file for Inno Setup Configurator
; Setup.exe config file
; Using Inno setup : http://www.jrsoftware.org/
; Install extra .exe and .msi
[Setup]
AppName=App Name
AppVersion=1.0
DefaultDirName={pf}\MyFolder
Compression=lzma2
@3ffusi0on
3ffusi0on / gist:4ff5c506f032f5c7cfea
Created February 1, 2016 16:06
Javascript timestamp to date
function timestampToDateString(timestamp){
var a = new Date(UNIX_timestamp * 1000);
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var year = a.getFullYear();
var month = months[a.getMonth()];
var date = a.getDate();
var hour = a.getHours();
var min = a.getMinutes();
var sec = a.getSeconds();
var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec ;
@3ffusi0on
3ffusi0on / gist:922e5a0338b6c0f83d4f
Created January 18, 2016 16:22
Passing PHP Arrays to JavaScript
var array = <?php echo '["' . implode('", "', $array) . '"]' ?>;
@3ffusi0on
3ffusi0on / gist:fed41d5da5b4eebd6871
Created January 18, 2016 15:58
Fix slow Right-clic on Windows
1. Download ShellExView: http://www.nirsoft.net/utils/shexview.html
This program does not require installation, just right click and run as Administrator
2. From the menu, click on Options then click on Filter by Extension Type and select Context Menu.
3. On the list, you'll see some of the entries with pink background, those are installed by the third party software
4. Hold down CTRL Key and select all of them then click on the red button on top left corner to disable.
5. Click on the Options again and select Restart Explorer
@3ffusi0on
3ffusi0on / isNetworkAvailable()
Created January 4, 2016 15:06
Android function to check network availability
private Boolean isNetworkAvailable() {
ConnectivityManager connectivityManager
= (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
}
@3ffusi0on
3ffusi0on / .htaccess
Created January 2, 2016 12:27
.htaccess for mobile devices redirection to subdomain
#######################
# Subdomain redirection
#######################
RewriteEngine on
RewriteBase /
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.website.com]