Skip to content

Instantly share code, notes, and snippets.

@mrioan
mrioan / umount_time_machine.sh
Created March 28, 2023 18:38
Umount Time Machine
hdiutil detach /Volumes/TimeMachine
@mrioan
mrioan / time_machine.sh
Created March 28, 2023 18:37
Time Machine
mkdir -p /tmp/TimeMachine; \
sudo mount_smbfs smb://[email protected]/backup/live/TimeMachine /tmp/TimeMachine; \
sudo hdiutil attach -mountpoint /Volumes/TimeMachine /tmp/TimeMachine/mbpm1pro2021.sparsebundle; \
tmutil startbackup -b; \
sh /Users/mario/Misc/scripts/umount_time_machine.sh
@mrioan
mrioan / create_user.sh
Last active September 4, 2023 13:34
Script to create users in an Asus router (OpenWRT) to login via SSH for instance
#!/bin/sh
echo -e "\nUsage: create_user.sh <username> <password>"
USERNAME=$1
PASSWORD=$2
echo "Creating user ${USERNAME}"
if [ ! -d "/home/${USERNAME}" ]
then
echo "Directory /home/${USERNAME} does not exist. Let's continue normally."
mkdir /home/${USERNAME}
https://teams.live.com/meet/93960940904093
@mrioan
mrioan / gist:c33943292002bcd4cb61
Created March 6, 2015 17:23
JWT creation and verification
/**
* Sample method to obtain data from the JWT response sent by the IDSite and create a new custom JWT
*/
private String createJWT(HttpServletRequest request, String issuer, long ttl) {
IdSiteCallbackHandler idSiteCallbackHandler = application.newIdSiteCallbackHandler(request);
AccountResult accountResult = idSiteCallbackHandler.getAccountResult();
long nowMillis = System.currentTimeMillis();
Date now = new Date(nowMillis);
@mrioan
mrioan / Oauth 2.0 Request Sample
Created October 14, 2014 20:24
EXCHANGING API KEYS FOR OAUTH 2.0 TOKENS
import com.stormpath.sdk.api.ApiKey;
import com.stormpath.sdk.api.ApiKeys;
import com.stormpath.sdk.application.Application;
import com.stormpath.sdk.client.Client;
import com.stormpath.sdk.client.Clients;
import com.stormpath.sdk.error.authc.AccessTokenOauthException;
import com.stormpath.sdk.http.HttpMethod;
import com.stormpath.sdk.http.HttpRequest;
import com.stormpath.sdk.http.HttpRequests;
import com.stormpath.sdk.impl.util.Base64;
@mrioan
mrioan / gist:8055969
Created December 20, 2013 15:01
Option B: Non Blocking API
Option B: Non Blocking API
Stormpath Wrapper Service
-------------------------
class NonBlockingExecution(implicit executionContext: ExecutionContext) {
def doAsync[S]( func: () => S) : Future[S] = {
val promise = Promise[S]
@mrioan
mrioan / gist:8055959
Created December 20, 2013 15:00
Option A: Blocking API
Option A: Blocking API
Stormpath Wrapper Service
-------------------------
class BlockingExecution {
val maxBlockingBacklog: Int = 100
val service = new ThreadPoolExecutor(32, /* corePoolSize */
2012-08-29 15:30:24,071 DEBUG [org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer] (main) Error during deploy: vfszip:/C:/tools/jboss-5.0.1.GA/server/default/deploy/sim-6.0.1.war/
org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfszip:/C:/tools/jboss-5.0.1.GA/server/default/deploy/sim-6.0.1.war/
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:337)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:297)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:269)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:230)
at org.jboss.deployers.plugins.deplo
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception