Skip to content

Instantly share code, notes, and snippets.

/Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=56062:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/allenw/nexus-backend-debugger/target/classes:/Users/allenw/.m2/repository/com/spotify/ads/protobuf-common/3.1.215/protobuf-common-3.1.215.jar:/Users/allenw/.m2/repository/com/spotify/ads/protobuf-common-annotations/3.1.215/protobuf-common-annotations-3.1.215.jar:/Users/allenw/.m2/repository/com/spotify/uri/0.1.138/uri-0.1.138.jar:/Users/allenw/.m2/repository/com/spotify/ads/nexus-client/0.0.142/nexus-client-0.0.142.jar:/Users/allenw/.m2/repository/com/spotify/ads/nexus-module/0.0.142/nexus-module-0.0.142.jar:/Users/allenw/.m2/repository/com/spotify/grpc/logging/0.54.5/logging-0.54.5.jar:/Users/allenw/.m2/repository/com/spotify/grpc/netty-dns-resolver/0.54.5/netty-dns-resolver-0.54.5.jar:/Users/allenw/.m2/repository/io/netty/netty-resolver/4.1.89.Final/netty-resolver-4.1.89.F
public static void assign(int n) {
// out put strings in this method.
StringBuilder sb = new StringBuilder();
backtracking(0, n, sb);
}
private static void backtracking(int index, int n, StringBuilder sb) {
if (index == n) {
System.out.println(sb.toString());
return;
// Java program to illustrate
// ThreadPool
package com.company;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutorService;
@wang-nima
wang-nima / gist:edac2faf8e6ea388d911344c44364fd8
Created September 18, 2017 06:02 — forked from ept/gist:4475995
Syntax highlighting code for PowerPoint (Mac OS)

How to add syntax-highlighted code to PowerPoint slides (Mac OS)

  1. pygmentize -f rtf FILE | pbcopy
  2. Paste into TextEdit (in rich text mode: Format → Make Rich Text before pasting), and copy to clipboard again.
  3. In PowerPoint, Edit → Paste Special… → Styled Text.

(Pasting RTF directly into PowerPoint doesn't work correctly, at least with PowerPoint 2008 — it extends colour spans longer than it should, and sometimes removes line breaks. Going via TextEdit seems to solve the problem.)

@wang-nima
wang-nima / .cpp
Created October 25, 2015 06:02
像素比例
struct TreeNode {
bool color;
vector<TreeNode*> next;
TreeNode (bool c) : color(c), next(4, nullptr) {}
};
double getPercentage(TreeNode *root) {
if (next[0] == nullptr && next[1] == nullptr && next[2] == nullptr && next[3] == nullptr) {
return 1;
}
@wang-nima
wang-nima / .cpp
Created September 28, 2015 20:44
quicksort
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int partition(vector<int> &v, int low, int high) {
int pivot = v[low];
int index = low + 1;
for (int i = low + 1; i <= high; i++) {
if (v[i] < pivot) {
@wang-nima
wang-nima / .cpp
Created September 22, 2015 21:51
1. 给一个二维数组,对角线打印 例子: 1 2 3 4.5 6 7 8 9 10 11 12 打印出 1 2 5 3 6 9 4 7 10 8 11 12
// http://www.1point3acres.com/bbs/forum.php?mod=viewthread&tid=141288&extra=page%3D1%26filter%3Dsortid%26sortid%3D311%26sortid%3D311
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
using namespace std;
void print(vector<vector<int>> a) {
int m = (int)a.size();
@wang-nima
wang-nima / client.go
Last active September 17, 2015 06:02 — forked from jordanorelli/client.go
rpc server example in go
package main
import (
"bufio"
"log"
"net/rpc"
"os"
)
func main() {
#include <iostream>
#include <string>
#include <unordered_set>
#include <vector>
#include <unordered_map>
using namespace std;
vector<int> father;
void init() {
@wang-nima
wang-nima / a.cpp
Created September 11, 2015 06:09
decode string
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
using namespace std;
string intToBytes(unsigned int a) {
unsigned char mask = 0xff;
string ret;