Skip to content

Instantly share code, notes, and snippets.

View liluo's full-sized avatar
:octocat:
Hey, there ~

liluo liluo

:octocat:
Hey, there ~
View GitHub Profile
#!/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
PID=$(ps aux | grep '/home/project/myenv/bin/python -c from multiprocessing' | grep -v grep | awk {'print $2'} | xargs)
if [ "$PID" != "" ]
then
#!/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"

Keybase proof

I hereby claim:

  • I am liluo on github.
  • I am liluo (https://keybase.io/liluo) on keybase.
  • I have a public key ASD4tzuHo4fZ3OJyRF63A0f2RA21Gogwuzsml8tVPQ1-sAo

To claim this, I am signing this object:

@liluo
liluo / goroutines.swift
Created July 5, 2019 08:54 — forked from chriseidhof/goroutines.swift
goroutines.swift
import Foundation
protocol Channel: IteratorProtocol {
func send(_ value: Element?)
}
/// A blocking channel for sending values.
///
/// `send` and `receive` must run in separate separate execution contexts, otherwise you get a deadlock.
final class BlockingChannel<A>: Channel {
@liluo
liluo / Embedding GoLang into a Ruby application.md
Created July 3, 2019 13:00 — forked from schweigert/Embedding GoLang into a Ruby application.md
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

{
"clusters": [
{
"account": "g_k8s_dev0",
"application": "treasureship",
"capacity": {
"desired": 1,
"max": 3,
"min": 2
},
@liluo
liluo / spacemacs-cheshe.md
Created March 28, 2018 06:19 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@liluo
liluo / spacemacs-keybindings
Created March 28, 2018 05:28 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
function rc {
release_branch=`git branch | grep release/ | sort -r | head -n 1 | sed -e s/'* '// | awk '{print $1}'`
diff_branchs="master..$release_branch"
echo -e "\e[34;5;204mRelease branch: $release_branch, diff: $diff_branchs, commits: \e[0m"
text=`git log $diff_branchs --pretty=format:'- %s by @%an' --reverse | grep -v Merge | sort | uniq`
echo $text
}
Thread-9jnxc
looping.rb:17:in `block (2 levels) in <main>'
\_ looping.rb:15:in `each'
\_ looping.rb:15:in `block in <main>'
\_ looping.rb:22:in `call'
\_ looping.rb:22:in `condition'
\_ looping.rb:26:in `looping'
\_ looping.rb:31:in `<main>'