Skip to content

Instantly share code, notes, and snippets.

@thom8
thom8 / vagrant-box-update-all.sh
Last active September 15, 2017 16:33
Update all your vagrant base boxes
#!/bin/bash
# Find all boxes which have updates
AVAILABLE_UPDATES=`vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2`
if [ ! ${#AVAILABLE_UPDATES[@]} -eq 0 ]; then
for box in $AVAILABLE_UPDATES ; do
echo "Found an update for $box"
  • 为什么要jQuery 到 Vue

  • 为什么要MVVM

  • python 模板引擎实现数据渲染

  • jQuery 的组件,一样可以重用。

  • css不大,不需要合并压缩

  • 不需要调试接口,不需要代理环境。

@bruienne
bruienne / xhyverun.sh
Last active October 4, 2018 09:40
xhyve boot2docker sample config
#!/bin/sh
KERNEL="/path/to/vmlinuz64"
INITRD="/path/to/initrd.img"
#CMDLINE="earlyprintk=serial console=ttyS0 acpi=off"
CMDLINE="loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10:LABEL=boot2docker-data base"
MEM="-m 1G"
#SMP="-c 2"
NET="-s 2:0,virtio-net,en0"
@icyleaf
icyleaf / post-receive.sh
Created September 6, 2010 07:55
git autodeploy script when it matches the string "[deploy]"
#!/bin/sh
#
# git autodeploy script when it matches the string "[deploy]"
#
# @author icyleaf <icyleaf.cn@gmail.com>
# @link http://icyleaf.com
# @version 0.1
#
# Usage:
# 1. put this into the post-receive hook file itself below
@skyisle
skyisle / icloud-ssh
Created February 18, 2012 01:44
Shell script to connect icloud host through ssh
#!/bin/bash
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` hostname"
exit $E_BADARGS
fi
HOSTNAME=$1
DOMAIN=$(echo show Setup:/Network/BackToMyMac | scutil | sed -n 's/.* : *\(.*\).$/\1/p')
#!/bin/bash
OLDIFS=$IFS
export IFS=$'\n'
# Find all boxes which have updates
AVAILABLE_UPDATES=$(vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2 2>/dev/null)
if [[ ${#AVAILABLE_UPDATES[@]} -ne 0 ]]; then
public Bitmap blurBitmap(Bitmap bitmap){
//Let's create an empty bitmap with the same size of the bitmap we want to blur
Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
//Instantiate a new Renderscript
RenderScript rs = RenderScript.create(getApplicationContext());
//Create an Intrinsic Blur Script using the Renderscript
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
@mikaelhg
mikaelhg / Demo.java
Last active May 4, 2022 06:49
Spring Boot @scheduled + Spring Security @PreAuthorize = RunAs
@Service
class FooService {
@Inject FooDao dao;
@Scheduled(fixedRate = 600000L, initialDelay = 60000L)
public void periodicalTask() throws IOException {
RunAs.runAsAdmin(() -> {
dao.save(new Foo(...));
});
@jbub
jbub / clean-macports.sh
Created July 8, 2013 21:23
Clean macports temporary build files and remove inactive ports.
# remove all temporary build files
sudo port clean --all installed
# remove all inactive ports
sudo port -f uninstall inactive
@lukaspili
lukaspili / ScrollableViewController.swift
Last active March 17, 2023 12:35
Scroll view snap kit
import UIKit
import SnapKit
class ScrollableViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.whiteColor()
let scrollView = UIScrollView()