Skip to content

Instantly share code, notes, and snippets.

View cazacugmihai's full-sized avatar

Mihai Cazacu cazacugmihai

View GitHub Profile
/*
* Copyright (c) 2011-2015 The original author or authors
* ------------------------------------------------------
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
# perform a fresh install of Ubuntu 17.10
# upgrade the kernel to v4.13.10
mkdir ~/kernel-v4.13.10
cd ~/kernel-v4.13.10
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-headers-4.13.10-041310_4.13.10-041310.201710270531_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-headers-4.13.10-041310-generic_4.13.10-041310.201710270531_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13.10/linux-image-4.13.10-041310-generic_4.13.10-041310.201710270531_amd64.deb
sudo dpkg -i *.deb
# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@cazacugmihai
cazacugmihai / extract-attachments.py
Created September 16, 2017 13:39 — forked from stefansundin/extract-attachments.py
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. Please use Python >= 3.4.
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: http://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original". Move the file to the same directory as this script.
import email
import sys
import os
# +-----------+-----------+
# | 1_1 | 2_1 |
# | | |
# +-----+-----+-----+-----+
# | 1_2 | 1_3 | 2_2 | 2_3 |
# | | | | |
# +-----+-----+-----+-----+
# | 3_1 | 4_1 |
# +-----------+ |
# | 3_2 +-----+-----+
@cazacugmihai
cazacugmihai / PasswordUtils.java
Last active September 21, 2015 09:21 — forked from ToastShaman/PasswordUtils.java
A utility class for hashing passwords using PBKDF2 with BouncyCastle.
package com.zuhlke.lsapi;
import org.bouncycastle.crypto.PBEParametersGenerator;
import org.bouncycastle.crypto.digests.SHA3Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.prng.DigestRandomGenerator;
import java.util.Base64;
@cazacugmihai
cazacugmihai / cors-nginx.conf
Last active September 8, 2015 12:08 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
/*
* This work is licensed under the Creative Commons Attribution 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
* or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*/
/*
* Define your version here
*/
@cazacugmihai
cazacugmihai / hazelcast.groovy
Created February 27, 2014 12:25
hazelcast - issue #1688
// start with: groovy -Djava.util.logging.config.file=logging.properties hazelcast.groovy
@GrabResolver(name='hazelcast', root='https://oss.sonatype.org/content/repositories/snapshots', m2Compatible=true)
@Grab('com.hazelcast:hazelcast:3.1.6')
import com.hazelcast.config.Config
import com.hazelcast.core.Hazelcast
import com.hazelcast.core.HazelcastInstance
import java.util.concurrent.ConcurrentMap
import static com.hazelcast.config.PartitionGroupConfig.MemberGroupType.HOST_AWARE
/* tested on PhantomJS 1.6 */
var page = require('webpage').create(), loadInProgress = false, fs = require('fs');
var htmlFiles = new Array();
// console.log(fs.workingDirectory);
// console.log(phantom.args[0]);
var curdir = phantom.args[0] || fs.workingDirectory;
var curdirList = fs.list(curdir);