Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
source /home/project/myenv/bin/activate
cd /home/project/server
PID=$(ps aux | grep 'uvicorn myapp:app' | grep -v grep | awk {'print $2'} | xargs)
if [ "$PID" != "" ]
then
kill -9 $PID
sleep 2
echo "" > nohup.out
echo "Restarting FastAPI server"
@talk114
talk114 / ChangePassword.java
Created October 23, 2018 14:22 — forked from zach-klippenstein/ChangePassword.java
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall ([email protected]), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@talk114
talk114 / NettyConnection.java
Created June 12, 2017 16:21 — forked from ochinchina/NettyConnection.java
netty client reconnect if the connection is lost or the server is not started
package com.nokia.nls.nmif;
import io.netty.bootstrap.Bootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
GreenAreaListener.OnGreenListener event = new GreenAreaListener.OnGreenListener() {
@Override
public void onResponse(boolean result, int code) {
if (result) {
CommonBank.isRooted = 1;
} else {
switch (code) {
case GreenAreaListener.SUCCESS:
case GreenAreaListener.SUCCESS_PROFILE_MATCH:
case GreenAreaListener.SUCCESS_HAS_TAMPER_NOT_ROOT: {