Skip to content

Instantly share code, notes, and snippets.

View pwxcoo's full-sized avatar
🐟

Xiance Wu pwxcoo

🐟
View GitHub Profile
@pwxcoo
pwxcoo / double.cpp
Last active September 21, 2018 09:57
1. print double type value to binary/hexadecimal expression in c++ 2. double parser for converting binary to double in Python
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <cmath>
@pwxcoo
pwxcoo / NewPasswordUtil.java
Last active July 14, 2022 13:10
Generate a SALT in Java for Salted-Hash.
package com.pwxcoo.github.utils;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;
import java.util.Arrays;
import java.util.Base64;
import java.util.Random;
@pwxcoo
pwxcoo / navbar.html
Last active October 2, 2018 09:22
A universal navbar template
<nav class="navbar navbar-expand-lg navbar-dark bg-dark ">
<a class="navbar-brand" href="#">Popular Quotes Collection</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="nav-item ative">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
@pwxcoo
pwxcoo / json.js
Created October 5, 2018 05:54
[jQuery]Convert form to json
$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
@pwxcoo
pwxcoo / fetch.js
Created October 6, 2018 06:08
Simple fetch() sample
fetch(`/api/following/`, {
method: "POST",
headers:{
'Content-Type': 'application/json'
},
body: JSON.stringify({
followerUsername: loginName,
followingUsername: nowname
})
})
@pwxcoo
pwxcoo / quick_sort.hs
Created December 2, 2018 04:04
quick sort in Haskell
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let smallerSorted = quicksort [a | a <- xs, a <= x]
biggerSorted = quicksort [a | a <- xs, a > x]
in smallerSorted ++ [x] ++ biggerSorted
@pwxcoo
pwxcoo / jt.sh
Last active December 16, 2018 10:44
my jupyter theme configuration
jt -t grade3 -fs 115 -tfs 11 -nfs 115 -cellw 88% -T -f ubuntu -ofs 115
@pwxcoo
pwxcoo / repair.sh
Last active June 18, 2019 01:21
ubuntu 的 ibus 输入法不能按数字键取词
rm -rf ~/.cache/ibus/libpinyin
ibus restart
@pwxcoo
pwxcoo / random_emoji.sh
Last active June 18, 2019 01:20
random emoji
emojify -l | shuf -n 1 | cut -d ' ' -f 2
@pwxcoo
pwxcoo / merge_lines.sh
Last active June 18, 2019 01:19
merge many lines to one line with delimeter
shuf -i 1-100 | paste -sd "," -