Skip to content

Instantly share code, notes, and snippets.

#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
@kamelzcs
kamelzcs / install-gcc-9.sh
Created February 20, 2022 03:36 — forked from alexandreelise/README.md
Install gcc 9 on Ubuntu LTS 12.04,14.04,16.04 and 18.04
#!/usr/bin/env sh
sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update -y && \
sudo apt-get install gcc-9 g++-9 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
@kamelzcs
kamelzcs / ByteBuddy.java
Created April 12, 2021 13:56
byte-buddy mock DAO
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Key {
String key();
}
public interface Pojo {
@Key(key = "a")
String getKey();
}
@kamelzcs
kamelzcs / command.sh
Last active February 19, 2020 11:58
Command
copyq paste
copyq clipboard
copyq clipboard > tmp
pwd | copyq copy -
pwd | copyq add -
sudo lsof -n -i :27017 | grep LISTEN
scp -r specs/* jenkins-master:/home/ec2-user/BTFYT-1688/
getBranchName() {
git branch | grep \* | cut -d ' ' -f2
}
public class Solution {
public int search(int[] nums, int target) {
int left = 0, right = nums.length - 1;
while (left <= right) {
int mid = left + (right - left) / 2;
if (nums[mid] == target) {
return mid;
}
if (nums[left] <= nums[mid]) {
@kamelzcs
kamelzcs / ubuntu_agnoster_install.md
Created August 8, 2018 03:46 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

class Solution {
private List<String> result = new ArrayList<>();
private List<ArrayList<Integer>> last ;
private String s;
private void dfs(int endIndex, String part) {
if (endIndex <= 0) {
result.add(part);
return;
}
String nextPart;

語彙

いっその事 rather 煙草 たばこ 呟く つぶやく 覗く のぞく 身を包む つつむ 獣 けもの 檻 おり 途端に 急に がらんと empty

@kamelzcs
kamelzcs / file
Created July 10, 2018 07:20
Mac software
SearchBar
AdBlock
Vimium
Quick Tabs
Tampermonkey
Flycut
Spectacle
@kamelzcs
kamelzcs / gist:c99f4a16b2f53fe62e87f50be44c1201
Created July 2, 2018 14:09
Regular Expression Matching
public class Solution {
public boolean isMatch(String s, String p) {
boolean[][] dp = new boolean[s.length() + 1][p.length() + 1];
dp[0][0] = true;
for (int j = 1; j < p.length(); j++) {
if (p.charAt(j) != '*') {
continue;
}
dp[0][j + 1] = dp[0][j - 1];
}