This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d "addr:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reboot with Command + R to enter into Recovery Mode. | |
"OS X Utilities" -> "Terminal" | |
$ csrutil disable; reboot | |
check status | |
$ csrutil status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://stackoverflow.com/questions/9853325/how-to-convert-a-svg-to-a-png-with-image-magick | |
$ inkscape -z -e test.png -w 1024 -h 1024 test.svg | |
npm install svgexport -g | |
svgexport input.svg output.png 64x | |
svgexport input.svg output.png 1024:1024 | |
convert -density 1200 -resize 200x200 source.svg target.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo /usr/libexec/locate.updatedb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo codesign -f -d -s - /Applications/Alfred\ 3.app/Contents/Frameworks/Alfred\ Framework.framework/Versions/A/Alfred\ Framework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl rand -base64 8 | cut -c 1-9 | |
# 生成128位随机串 | |
cat /dev/urandom | od -X -N 16 | head -n 1 | cut -d ' ' -f 2- | tr -d ' ' | |
# 生成8字节长度随机串,27 = 9 + 16 | |
cat /dev/urandom | od -x | head -c 27 | cut -d ' ' -f 2- | tr -d ' ' | |
# 生成16字节长度随机串,41 = 9 + 32 | |
cat /dev/urandom | od -x | head -c 41 | cut -d ' ' -f 2- | tr -d ' ' | |
# 生成32字节长度随机串(最长32字节) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh 192.168.1.1 "echo 'newpassword' | passwd --stdin root" | |
Ubuntu下没有--stdin选项,此时用chpasswd | |
echo user:newpassword | chpasswd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wxRect rect(0,0,200,200); | |
unsigned int image_buffer_len = rect.width * rect.height * 4; | |
unsigned char *image_buffer = (unsigned char*)new unsigned char[image_buffer_len]; | |
cairo_surface_t *cairo_surface = cairo_image_surface_create_for_data(image_buffer, CAIRO_FORMAT_RGB32, rect.width, rect.height, rect.width * 4); | |
cairo_t *cairo_image = cairo_create(cairo_surface); | |
Render(cairo_image, rect.width, rect.height); | |
unsigned char *output = (unsigned char*)new unsigned char[image_buffer_len]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -m SimpleHTTPServer 8080 | |
python3 -m http.server | |
npm install -g live-server |
OlderNewer